I have the following szenario:
I have gameobject which stores a pointer to a Rigidbody. (which is then added with addRigidbody to the physics world)
This gameobject can also store other data like a 3D Model, healthpoints, etc...
Now what i want to do is to delete the whole gameobject after colliding with the rigidbody or picking it with a raycast.
With a raycast it would look like this:
Code: Select all
btCollisionWorld::ClosestRayResultCallback RayCallback(start, end);
this->collisionWorld->getDynamicsWorld()->rayTest(start, end, RayCallback);
if (RayCallback.hasHit()) {
//get the pointer of the collisionObject.
const btCollisionObject* hitObj = RayCallback.m_collisionObject;
}
Does Bullet have some form of built-in support for that type of stuff?
Or do i have to store the pointer of this rigidbody manually in (as an example) map datastructure as a key and store the pointer of the gameobject as the value? (So that i can simply retrieve the gameobject by looking up the pointer returned by the raycast.)
I'm relatively new to bullet and trying to grasp it's architecture.