- Home /
How to translate car wheels to suspension?
Hey guys,
I am trying to update the tires y-pos according to the suspension, like when the car flies the suspension is fully stretched and the tires should also move to the specific y-position.
There is something about a wheelhit that handles all the stuff but I dont get the correct query syntax of it.
function TranslateWheels(){
wheelFL.GetGroundHit(wheelhitFL);
var p = new Vector3(wheelhitFL.point.x, wheelhitFL.point.y + 0.33f, wheelhitFL.point.z);
tireFL.position = p;
}
This will let the tire be always at the point no matter if the wheelcollider is not touching the ground.
Any ideas?
Answer by RLin · Oct 02, 2015 at 02:48 PM
The parameter wheelhit.point returns the exact point that the wheelcollider touches the ground. You will have to move the visual wheel to this point.
You will also want to check if GetGroundHit returns false. If so, the car is flying, and the wheels are not touching the ground. So wheels can drop to whatever "fully stretched" distance you choose.