I wanted to create inherited versions of btCollisionObject and btRigidObject that have a pointer to my GameEntity class that created that collision object. I have been trying to get this to work with btPersistentManifold::getBody0 and getBody1 (in a similar manner as in CollisionInterfaceDemo.cpp,) but I cannot get it to work -- a lot of crashing occurs.
How can I inherit from both btCollisionObject and btRigidObject properly and be able to get the game entity pointers of the objects that are touching? Is using getManifoldByIndexInternal the best way of handling this?
Inheriting btCollisionObject & using btPersistentManifol
-
- Posts: 3
- Joined: Wed Jul 18, 2007 12:10 am
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Inheriting btCollisionObject & using btPersistentMan
It is recommended to simple store a pointer to your game entity inside the Bullet object. See setUserPointer and getUserPointer in btCollisionObject.
Hope this helps,
Erwin
Hope this helps,
Erwin
-
- Posts: 3
- Joined: Wed Jul 18, 2007 12:10 am