[Feature request] method to provide collision object index

gokoon
Posts: 9
Joined: Fri Jan 27, 2012 10:57 am

[Feature request] method to provide collision object index

Post by gokoon »

I made an Ogre3D application, and am using bullet only to detect collisions.

I use a vector of objects in ogre, and fill the array in CollisionWorld::getCollisionObjectArray() with the corresponding index.
For example if I have a certain ogre object in:
Entities[45];
The corresponding bullet collision object will be in
collisionWorld->getCollisionObjectArray()[45];

The problem is that the way bullet is designed, it doesn't provide directly the index of the collision index, I need to either build a map or use setUserPointer() getUserPointer(), which use a void *, I could use that, but it's not the best way.

I don't know if it's possible (I don't really know how bullet is designed) or too much to ask, but could you add another callback method which just provide the index of the CollisionObject which collided, instead of a pointer to the said CollisionObject ?
monkeyman
Posts: 22
Joined: Sat Nov 26, 2011 5:41 pm

Re: [Feature request] method to provide collision object ind

Post by monkeyman »

normally, objects are added and removed all the time to the world, so the actual indices in the internal arrays are not really meaningful...

i would say that the user pointer system in this case actually seems like the best way to get your ogre index back.

just set the user pointer in the bullet collision object to the address of the ogre Entities entry?

btobj->setUserPointer(&ogre.Entities[45]);

or something similar, then when something collides you immediately can access the ogre entity.