while trying to figure out why a wheel in the vehicles of 'SuperTuxKart' sometimes lose contact with the ground (resulting in a sudden rotation of the kart, since only one wheel would deliver the engine force), I stumbled over the following bullet code (btRaycastVehicle.cpp):
Code: Select all
btScalar btRaycastVehicle::rayCast(btWheelInfo& wheel)
...
btScalar raylen = wheel.getSuspensionRestLength()+wheel.m_wheelsRadius;
btVector3 rayvector = wheel.m_raycastInfo.m_wheelDirectionWS * (raylen);
const btVector3& source = wheel.m_raycastInfo.m_hardPointWS;
wheel.m_raycastInfo.m_contactPointWS = source + rayvector;
const btVector3& target = wheel.m_raycastInfo.m_contactPointWS;
- Instead of using the suspension rest length, shouldn't the maximum suspension length be used? I.e.? This value (well, withouth wheel radius) is then used a bit further down to clamp the actual suspension length.
Code: Select all
btScalar raylen = wheel.getSuspensionRestLength()+ wheel.m_maxSuspensionTravelCm*btScalar(0.01)+wheel.m_wheelsRadius;
- Talking of maxSuspensionTravelCm: is the default for this (500) appropriate? Seems way too big (assuming 1 unit = 1 m, the suspension can travel by +- 5m ... if I understand the code correctly).
Cheers,
Joerg