- Home /
accelerate and brake using Math.lerp ?
I've got a simple bike setup with hinge joints and sphere colliders instead of the usual wheel colliders. At the moment i've got the hingeJoint.motor.force set from the transH float from the Input.GetAxis. The problem is that to brake i'm affectively going in reverse and i'm also getting way to much gyro effect from the wheels but thats another story I guess.
I'm wondering if its better to use some sort of lerp with the hingeJoint.motor.force but i'm having no luck scripting it as yet if anybody can help perhaps ?
This is what i've got currently without lerp -
var MotorForce : float = 0.0;
function FixedUpdate () {
var transH : float = Input.GetAxis ("Horizontal") * MotorForce * Time.deltaTime;
hingeJoint.motor.targetVelocity = 2000;
hingeJoint.motor.force = transH;
}
Comment