function Update () {
GetAngle(GetInput());
}
var angle = Vector3.zero;
function GetInput(){
var x = Input.GetAxis("Horizontal");
var y = Input.GetAxis("Vertical");
angle = Vector3(y, x, 0);
return angle;
}
function GetAngle(input:Vector3){ //local rotation
transform.localEulerAngles = input * 180;
}
In this example. I press left arrow and the object rotates left,
if I press the right arrow immediately, the object’s rotation jumps suddenly to vector.zero, before it starts rotating right as it should.
How to make a smooth transition?