How to detect collision object name

Please don't post Bullet support questions here, use the above forums instead.
grol
Posts: 3
Joined: Tue Sep 28, 2010 8:18 am

How to detect collision object name

Post by grol »

Hi, I have different elements against my character can collision. All of them are btBvhTriangleMeshShapes, and I am using raycast to detect the proximity to the objects. My question is that I don't know which object has been touched by the raycast, because I don't know how to put/get names to the shapes/rigidbodies.

Maybe it sounds stupid, but I've been reading the API and I've found the getName() for shapes, but it retrieve "Box" ....

Is there anyway that I can put a name to a collision object and retrieve it from the raycast collision?

Thanks in advance!
grol
Posts: 3
Joined: Tue Sep 28, 2010 8:18 am

Re: How to detect collision object name

Post by grol »

well, for the moment I've add the name attribute to the btRigidBody (I love open source!)

Anyway If is there a stablished solution and I'm missing something I would be appreciate to know.

Thanks!
Kanttori
Posts: 38
Joined: Thu Jul 08, 2010 12:52 am

Re: How to detect collision object name

Post by Kanttori »

There's a getUserPointer / setUserPointer in btCollisionObject which you can set to whatever you wish, probably most useful to have it point to the corresponding object in your own code.
grol
Posts: 3
Joined: Tue Sep 28, 2010 8:18 am

Re: How to detect collision object name

Post by grol »

wow, I didn't realized.

I'll change it.

Thanks!