I'm new to bullet, so I may be wording this wrong, but here goes.
If I have a program where I want to detect when two components collides. The components both register in a dynamic world, and get their position from that. Now when doing collision detection in bullet, I get back which two bullet objects collided, but I need to know which of my own objects collided. So i need to figure out which of my objects has a pointer to the bullet object in the collision. Of cause, I can safely assume that no two object occupy the same position and use this information to find my object by comparing the position of all objects to the colliding body. This seem like a hack more then the "right" way to do it. So is there a "correct" or most elegant way of going about this? Would I be able to use inheritance of btRigidbody to add a link that points back to the corresponding game link or would this break something or be too bothersome?
Any help is greatly appreciated.
A question on how to integrate bullet
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: A question on how to integrate bullet
You can use the user pointer for that (no need to derive from btRigidBody):
Thanks,
Erwin
Code: Select all
bulletObject->setUserPointer(yourPointer);
yourPointer = bulletObject->getUserPointer();
Erwin