rruiz
23-06-2008 22:19:52
Hello. I have 2 objects and a plane ... the objects collide with the plane but they do not collide among themselves ...my base class
this is my class:
and this is my metod collision
and this is a object
the other are defined like this.
why dont work???
this is my class:
class BaseApplication : public OgreOde::CollisionListener
{
public:
BaseApplication(void);
virtual ~BaseApplication(void);
virtual void go(void);
protected:
....
virtual bool collision(OgreOde::Contact* contact);
....
OgreOde::World *mWorld;
OgreOde::Space *mSpace;
OgreOde::StepHandler *mStepper;
OgreOde::Geometry* sGeom;
OgreOde::InfinitePlaneGeometry *mGround;
OgreOde::Body *mBody;
Ogre::SceneNode *mNode;
Ogre::Entity *mEntity;
};
and this is my metod collision
bool BaseApplication::collision(OgreOde::Contact* contact)
{
// Check for collisions between things that are connected and ignore them
OgreOde::Geometry * const g1 = contact->getFirstGeometry();
OgreOde::Geometry * const g2 = contact->getSecondGeometry();
if (g1 && g2)
{
const OgreOde::Body * const b1 = g1->getBody();
const OgreOde::Body * const b2 = g2->getBody();
if (b1 && b2 && OgreOde::Joint::areConnected(b1, b2))
return false;
}
//set contact parameters:
contact->setBouncyness(1.0);
contact->setCoulombFriction(OgreOde::Utility::Infinity);
contact->setForceDependentSlip(1.0);
contact->setAdditionalFDS(1.0);
return true;
}and this is a object
mEntity = mSceneMgr->createEntity("crate","habPrueba.mesh");
mEntity->setQueryFlags (1<<2);
SceneNode* mNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
mNode->attachObject(mEntity);
mEntity->setNormaliseNormals(true);
mEntity->setCastShadows(true);
mBody = new OgreOde::Body(mWorld);
mNode->attachObject(mBody);
Vector3 size(2.0,2.0,2.0);
OgreOde::BoxMass mMass(1,size);
mMass.setDensity(5.0,size);
mGeom = (OgreOde::Geometry*)new OgreOde::BoxGeometry(size, mWorld, mSpace);
mNode->setScale(size.x * 2.0,size.y * 2.0,size.z * 2.0);
mBody->setMass(mMass);
mGeom->setBody(mBody);
the other are defined like this.
why dont work???