car suspension works! here's a demo with variable damping and stiffness parameters.
I have gone through many iterations on how to properly do this, initially I was overthinking it, doing separate rigid body calculations for each wheel and trying to simulate a spring between each wheel and the chassis. I ended up scratching that as it produced too many fine calculation errors and the implementation was wonky and required a lot of change to the collision system to work well.
I ended up adopting a very simple raycasting method from the wheel attaching points downwards to the plane + a suspension offset, a simple collision check with the plane sets updates the suspension difference, otherwise a basic damped spring algorithm is done on the suspension: offset * stiffness - suspension_velocity * damping
. when the raycast collides with the plane, it adds an impulse equal to the suspension force on the car's respective connection point of the wheel. The wheels are just rendered at that offset point.
the result is the following: