kalda
29-01-2008 18:03:38
Hello!
I have small problem... I've code looks like simple scenes demo, but my Objects are falling trough the floor and trough other objects. Collision is detected in callback. I return true, but without change... Only Vehicle and ragdoll created by OgreOde loader are working...
Here is my code fe. for cube:
I have small problem... I've code looks like simple scenes demo, but my Objects are falling trough the floor and trough other objects. Collision is detected in callback. I return true, but without change... Only Vehicle and ragdoll created by OgreOde loader are working...
Here is my code fe. for cube:
bool CPhysBox::Init(IModel *target,float mass,float density,float sizeX,float sizeY,float sizeZ,bool useGravity,World *world,Space *space)
{
if(!world || !space) return false;
CModel *model = (CModel*)target;
if(!model) return false;
Entity *entity = model->GetEntity();
if(!entity) return false;
m_body = new Body(world);
if(!m_body) return false;
model->AttachObject(m_body);
BoxMass Mass(mass,Vector3(sizeX,sizeY,sizeZ));
Mass.setDensity(density, Vector3(sizeX,sizeY,sizeZ));
m_geometry = (Geometry*)new BoxGeometry(Vector3(sizeX,sizeY,sizeZ),world,space);
if(!m_geometry) return false;
m_body->setMass(Mass);
m_geometry->setBody(m_body);
entity->setUserObject(m_geometry);
m_body->setAffectedByGravity(useGravity);
return true;
}