- Home /
Rotation Ease-In-Out with MAX Rotation Speed
Hi,
I am looking for a way to rotate object on z (2D Game) with Ease-In-Out effect and maximum rotation speed, e.g. the speed the object will rotate at the middle of total rotation,
I am trying this because I need the max speed of the rotation not to be depending on the size of the rotation (30° vs 200°) (speed of the rotation has effect on the gameplay). Also I need it to get to max rotation speed for every rotation change.
Another problem is that I need it to take the shortest round, like Quaternion.Slerp() does.
I have looked everywhere for short solution but it has always been for time, and the rotation speed at Ease-In-Out will be higher when the gap is bigger, because is uses a time or similar way to interpolate though the rotation.
Answer by joihelgi · Apr 02, 2014 at 05:04 PM
The best solution I have found is:
Quaternion.Slerp(Quaternion.Euler(0f,0f, originalRotation), Quaternion.Euler(0f,0f, targetRotation), Mathf.SmoothStep(0f, 1f, Mathf.SmoothStep(0f, 1f, t)));
But with this I have little control over maximum rotation speed, I could calculate the (t) based on time and size of the change in rotation.
Your answer
Follow this Question
Related Questions
Use Lerp to rotate object 2 Answers
Basic AI Locked Axis 1 Answer
Best rotation function to use 1 Answer
Rotating Rigidbodies 2 Answers