1) I have some difficulties to implement correctly a Trigger class were callbacks are called when entering a zone, leaving or being inside it.
Do someone have such a generalised Trigger class that he can share or point to?
The documentation on trigger and callbacks seems to suggest to use only GhostObjects for trigger. Am I right?
2) Also can Contact callbacks (gContactAddedCallback, ...) be set at the Object level?
If not does it mean you need to keep a list of all objects in your code and use a big switch ?
Code: Select all
static bool CustomContactAddedCallback(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1)
{
if (colObj0 == trigger1)
trigger1->callback( colObj1 );
else if (colObj1 == trigger1)
trigger1->callback( colObjO );
else if (colObj0 == trigger2)
trigger2->callback( colObj1 );
else if (colObj1 == trigger2)
trigger2->callback( colObjO );
else if (colObj0 == trigger3)
trigger3->callback( colObj1 );
etc
return false;
}
Thanks for any help