I'm trying to implement "triggers" in my game, so I basically I copy/pasted the btGhostObject example from the wiki and got the thing working perfectly.
http://bulletphysics.org/mediawiki-1.5. ... d_Triggers
Later, to know which game object hit the "trigger" I inherited my GameObject class to the btRigidBody, so I could cast the manifold body this way:
Code: Select all
GameObject * auxGameObject = static_cast<GameObject*>(manifold->getBody1());Now, do you guys know if there is a way of guessing which class is the body really coming from? Say you have a classes like balls, players, cars, etc, ect. They all inherit from a btCollsionObject but you would like to do different things when they touch this trigger, like: if its a ball emit some force, if its a player upgrade his health, etc. Note this is an imaginary situation.
I usually do this with dynamics casts, but its not possible here, nor do I know if its efficient enough. So, have you ever wanted something like this? In that case how do you guys do it?