So I am making a vehicle physics wrapper for my game(aswell as one other game). I am doing kinda well with it, now I've gotten to suspension. And here I use simple method: I apply impulse downwards from each wheel equalient to it's load - that's the gravity. And I also apply impulse upwards from suspension. I have found this link: http://vehiclephysics.com/advanced/how-suspensions-work/ Where it's said that:
Fsuspension = Kspring * x + Fdamper * Vcontact
As you can notice already that springrate and damper force are constants. However, other 2 values are variables. I want to find out how to obtain contact depth(x) and contact speed(Vcontact) from a ray that I cast from wheel joint position downwards(in -Z axis relative to car). I already obtain the distance how far the ray reach, but I need to find out the compression using this distance. And also I need a way to determine the speed of contact.
Thanks already now! :D