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!
How to detect collision object name
-
- Posts: 3
- Joined: Tue Sep 28, 2010 8:18 am
Re: How to detect collision object name
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!
Anyway If is there a stablished solution and I'm missing something I would be appreciate to know.
Thanks!
-
- Posts: 38
- Joined: Thu Jul 08, 2010 12:52 am
Re: How to detect collision object name
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.
-
- Posts: 3
- Joined: Tue Sep 28, 2010 8:18 am
Re: How to detect collision object name
wow, I didn't realized.
I'll change it.
Thanks!
I'll change it.
Thanks!