diff --git a/src/physics/btKart.cpp b/src/physics/btKart.cpp index 10be3081d..8bd4f9df8 100644 --- a/src/physics/btKart.cpp +++ b/src/physics/btKart.cpp @@ -424,19 +424,34 @@ void btKart::updateVehicle( btScalar step ) // are on ground, or none of them. This avoids the problem of // the kart suddenly getting additional angular velocity because // e.g. only one rear wheel is on the ground. - for(i=0; i<4; i+=2) + for(i=0; igetCenterOfMassPosition(); + + chassis_velocity_at_contactPoint = getRigidBody()->getVelocityInLocalPoint(relpos); + + btScalar projVel = wheel_air.m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint ); + + wheel_air.m_suspensionRelativeVelocity = projVel; } - if(!(m_wheelInfo[i].m_raycastInfo.m_isInContact) && - m_wheelInfo[i+1].m_raycastInfo.m_isInContact) - { - m_wheelInfo[i].m_raycastInfo = m_wheelInfo[i+1].m_raycastInfo; - } - } // for i=0; i<4; i+=2 + } // for i=0; i