I have 2 CollisionObject with the same ShapeType (for example btBoxShape)
- how to detect which of them was hit by Ray ?
How to detect which CollisionObject was hit ?
-
- Posts: 229
- Joined: Sun Sep 30, 2007 7:58 am
Re: How to detect which CollisionObject was hit ?
Hi,
you can use the public property m_userObjectPointer in the collisionObject to store user data.
you can use the public property m_userObjectPointer in the collisionObject to store user data.
-
- Posts: 8
- Joined: Wed Jun 17, 2009 7:52 am
Re: How to detect which CollisionObject was hit ?
Hi pico
Thanks for reply,
Ok, i marked/customized all CollisionObjects, each object have it's own number.
But how i can get access to userdata from RayResultCallback ?
Thanks for reply,
Ok, i marked/customized all CollisionObjects, each object have it's own number.
But how i can get access to userdata from RayResultCallback ?
-
- Posts: 229
- Joined: Sun Sep 30, 2007 7:58 am
Re: How to detect which CollisionObject was hit ?
Hi,
you can access the ray result m_collisionObject.
I'm not sure why you want to know the shape. Usually people use the m_userData in m_collisionObject for a pointer to their internal game object structure.
If you just need to seperate objects you can use different filtergroups.
you can access the ray result m_collisionObject.
I'm not sure why you want to know the shape. Usually people use the m_userData in m_collisionObject for a pointer to their internal game object structure.
If you just need to seperate objects you can use different filtergroups.
-
- Posts: 8
- Joined: Wed Jun 17, 2009 7:52 am
Re: How to detect which CollisionObject was hit ?
Thanks pico
I get it !
Code: Select all
if (resultCallback.hasHit())
{
return resultCallback.m_collisionObject;
}