- Home /
Rotation speed increase gradually
Hi, basically the car rotates or 'tilts' around the center as controlled by the player, but because of the script i use it is very sudden, ie there is no 'easing' into or out of the rotation, I was wondering what i could use to create this easing so when the player presses the input key the rotation speeds up until a certain point, then when they let go it slows down quickly, but not suddenly as it is doing.
function FixedUpdate () {
//query input axes if necessarry
if(queryUserInput)
{
brake = Mathf.Clamp01(-Input.GetAxis("Vertical"));
handbrake = Input.GetButton("Jump")?1.0:0.0;
//steer = Input.GetAxis("Horizontal");
motor = Mathf.Clamp01(Input.GetAxis("Vertical"));
}
else
{
motor = 0;
//steer = 0;
brake = 0;
handbrake = 0;
}
if (Input.GetAxis("TiltLeft")){ transform.Rotate(Vector3(-1,0,0));
}
if (Input.GetAxis("TiltRight")){ transform.Rotate(Vector3(1,0,0));
}
}
It is the last part that controls the rotation, obviously :P
Comment