Car Suspension - Getting Contact Depth and Speed From rayCast() 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
OK! Here is the deal.
As I already told, I obtain the length of the contact ray already. I will not discuss it's obtanation here, it is just rayCast() method with some more math.
Now I do suspension_length - ray_distance.
This returns the contact depth or x value. To get the speed of it I make a property exdepth for my suspension and after the end of frame I store the depth(x) value into it. Than on start of frame I compare them like so: x - exdepth and than I get the contact speed value(Vcontact).
And that's it - issue solved;)