Fixed #539 (elephpant has problems with wheels when using convex hull
as collision shape). This appears to be a bullet problem (raycast for wheels is hitting the chassis), worked around this by disabling raycast collisions with chassis completely. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10556 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
324c976f2d
commit
a720994036
@ -205,6 +205,18 @@ void btKart::updateWheelTransformsWS(btWheelInfo& wheel,
|
||||
// ----------------------------------------------------------------------------
|
||||
btScalar btKart::rayCast(btWheelInfo& wheel)
|
||||
{
|
||||
// Work around a bullet problem: when using a convex hull the raycast
|
||||
// would sometimes hit the chassis (which does not happen when using a
|
||||
// box shape). Therefore set the collision mask in the chassis body so
|
||||
// that it is not hit anymore.
|
||||
short int old_group=0;
|
||||
if(m_chassisBody->getBroadphaseHandle())
|
||||
{
|
||||
old_group = m_chassisBody->getBroadphaseHandle()
|
||||
->m_collisionFilterGroup;
|
||||
m_chassisBody->getBroadphaseHandle()->m_collisionFilterGroup = 0;
|
||||
}
|
||||
|
||||
updateWheelTransformsWS( wheel,false);
|
||||
|
||||
|
||||
@ -292,6 +304,11 @@ btScalar btKart::rayCast(btWheelInfo& wheel)
|
||||
wheel.m_clippedInvContactDotSuspension = btScalar(1.0);
|
||||
}
|
||||
|
||||
if(m_chassisBody->getBroadphaseHandle())
|
||||
{
|
||||
m_chassisBody->getBroadphaseHandle()->m_collisionFilterGroup
|
||||
= old_group;
|
||||
}
|
||||
return depth;
|
||||
} // rayCast
|
||||
|
||||
@ -321,7 +338,7 @@ void btKart::updateVehicle( btScalar step )
|
||||
m_num_wheels_on_ground = 0;
|
||||
for (int i=0;i<m_wheelInfo.size();i++)
|
||||
{
|
||||
btScalar depth;
|
||||
btScalar depth;
|
||||
depth = rayCast( m_wheelInfo[i]);
|
||||
if(m_wheelInfo[i].m_raycastInfo.m_isInContact)
|
||||
m_num_wheels_on_ground++;
|
||||
|
Loading…
Reference in New Issue
Block a user