Fixing VehicleWheel friction

The idea is to drop the grip of the wheel when the suspension is compressed. Its a big problem if your vehicle is heavy with a powerful suspension, grip go to infinity.

First without the change, then with the change, I added 2 parameters to tweak the friction: Compressed Suspension Threshold and Compressed Friction Slip

What change?
from

real_t maximp = wheelInfo.m_wheelsSuspensionForce * s->get_step() * wheelInfo.m_frictionSlip;

to

real_t active_friction_slip = wheelInfo.m_frictionSlip;
if (wheelInfo.m_raycastInfo.m_suspensionLength <= wheelInfo.m_compressedSuspensionThreshold) {
active_friction_slip = wheelInfo.m_compressedFrictionSlip;
}
real_t maximp = wheelInfo.m_wheelsSuspensionForce * s->get_step() * active_friction_slip;

For the files
Github

1 Like