Slick wrote:How would I selectively ignore a collision if I didn't want it to happen? In older versions you would return 0.
you are probably confusing with the OnAABBOvelear call back, in the pass there where two callbacks, now there are three.
- Code: Select all
bool OnBodiesAABBOverlap (const dNewtonBody* const body0, const dNewtonBody* const body1, int threadIndex) const;
bool OnCompoundSubCollisionAABBOverlap (const dNewtonBody* const body0, const dNewtonCollision* const subShape0, const dNewtonBody* const body1, const dNewtonCollision* const subShape1, int threadIndex) const;
virtual void OnContactProcess (dNewtonContactMaterial* const contacts, dFloat timestep, int threadIndex) const;
OnBodiesAABBOverlap is the same as it was before, it is call from the broad phase, and return false reject teh collsions
OnCompoundSubCollisionAABBOverlap is teh newer whi si call frome teh mid phase, tehis is for compoudn ans scsne collision
and you cn arejest the collsion with specific supshape of a compoudn collisiosn
OnContactProcess is called from the narrow phase after all contacts are calculated.
here you can only reject contacts by delting the form eth contact array, yo ucna do tha is tyow ways.
the first way is by overloading your OnContactProcess in yor WordkClass, something like this
- Code: Select all
void OgreNewtonWorld::OnContactProcess (dNewtonContactMaterial* const contactMaterial, dFloat timestep, int threadIndex) const
{
void* nextContact = NULL;
for (void* contact = contactMaterial->GetFirstContact(); contact; contact = nextContact) {
nextContact = contactMaterial->GetNextContact(contact);
dNewtonCollision* const shape0 = contactMaterial->GetShape0(contact);
dNewtonCollision* const shape1 = contactMaterial->GetShape1(contact);
const dMaterialPairManager::dMaterialPair* const materialPair = m_materialMap.GetPair (shape0->GetMaterialId(), shape1->GetMaterialId(), threadIndex);
// do some condtion
//if (somecondition) {
// contactMaterial->RemoveContact(contact);
//}
}
OgreNewtonWorld::OnContactProcess (contactMaterial, timestep, threadIndex);
}
the secund way is by overloading the same function on the Body callback with a simular function, che out the ForkLift demo,
I do it to aligne contact to teh tire plane of rotation.
I suspect that you want to reject on per body or per shape bases, so you do not need the lower lever OnContactProcess
but the are all there in case you are doing something special.
Note: function RemoveContact(contact); was missing form teh contact material, I just added.
please sync to svn.