- Home /
Gradually Rotate Character 90 Degrees
Hello UA,
In my Top Down Shooter, I need an object to rotate 90 degrees to the right. I already know how to rotate an object so that's pretty easy, but what I need is for the object to rotate 90 degrees to the right but not instantly. In other words, I need it to gradually rotate 1 degree to the right but then stop rotating once it completely rotates 90 degrees.
I've heard of Quaternion.Slerp or Quaternion.Lerp but that's if you want to rotate the object to another Transform. I want my object to rotate 90 degrees on it's Y axis gradually.
I hope I'm not over complicating this :P
Thanks In Advance :)
what deter$$anonymous$$es how long you want it to take doing this?
ie. do you have an amount of time in $$anonymous$$d? Or is it responding to something else and should move to 90% in accordance with the speed of that "target"?
Well, I have a variable "rotateSpeed" so it would be like rotateSpeed * time.deltaTime somewhere.
Answer by Novodantis 1 · Dec 29, 2010 at 04:51 PM
You should be able to do this no prob with Mathf.MoveTowardsAngle(). The documentation for it explains how to use it, but basically it's a smooth transition over time that takes into account wrapping over 360 degrees:
http://unity3d.com/support/documentation/ScriptReference/Mathf.MoveTowardsAngle.html
Your answer
Follow this Question
Related Questions
Rotate object in a set amount of time 1 Answer
Rotate player 360 degrees once 0 Answers
Transform.Rotate() stuck at 90 and 270 degrees 3 Answers
Rotate 90 degrees over time with Parabolic Easing. 1 Answer
Rotate 90 over time on mouseDown 2 Answers