- Home /
Rotate angle
Hello!! Does anyone know how I can rotate an angle to another angle with chosen direction?
I understand that Mathf.MoveTowardsAngle rotates an angle, but choose to rotate in the direction close, I need to choose the direction, it is possible?
helpunity.png
(8.0 kB)
Comment
Could you be more specific? Is the angle in a transform or is it just a variable?
float time;
void Start(){
time = 0;
}
void Update () {
time += Time.deltaTime/10; //this variable is just for demonstrating the effect.
float angle = $$anonymous$$athf.Lerp(90, --set target angle 0 and 360 here respectively and see the difference-- , $$anonymous$$athf.Clamp01(time));//$$anonymous$$athf.Lerp(90, 0,$$anonymous$$athf.Clamp01(time)); or $$anonymous$$athf.Lerp(90, 360,$$anonymous$$athf.Clamp01(time));
transform.eulerAngles = new Vector3(angle, 0,0);
}
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
How do I rotate the hook? 1 Answer
How do i rotate an object "Once" 1 Answer
Problem with Clamping Values for Object's Rotation 1 Answer
How can I multiply the rotation of a mirrored object? 1 Answer