btDefaultVehicleRaycaster issue related to no contact bodies
Posted: Wed Aug 20, 2008 10:58 pm
I also posted the issue here: http://code.google.com/p/bullet/issues/detail?id=79
Basically, while creating a "sensor" type object I noticed that my vehicles were sometimes colliding with the sensor body. For example, while driving on a curved surface I would hit a static plane sensor even though it was set to no contact response. The body of the kart would go through it no problem but sometimes the wheels would seem to "catch" onto to the plane.
After a bit of thinking I realized that the btDefaultVehicleRaycaster doesn't check if the body that is casted against has contact response enabled.
The fix is very simple:
Old code:
New code:
So I basically wanted to just post this for anyone having an issue like this with vehicles and get some feedback on this solution.
Thanks.
Basically, while creating a "sensor" type object I noticed that my vehicles were sometimes colliding with the sensor body. For example, while driving on a curved surface I would hit a static plane sensor even though it was set to no contact response. The body of the kart would go through it no problem but sometimes the wheels would seem to "catch" onto to the plane.
After a bit of thinking I realized that the btDefaultVehicleRaycaster doesn't check if the body that is casted against has contact response enabled.
The fix is very simple:
Old code:
Code: Select all
if (rayCallback.hasHit())
{
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
if (body)
Code: Select all
if (rayCallback.hasHit())
{
btRigidBody* body = btRigidBody::upcast(rayCallback.m_collisionObject);
if (body && body->hasContactResponse())
Thanks.