Skip to content

How to animate rotation over 360 degrees? #20

Answered by KyryloKuzyk
benjaminZarate asked this question in FAQ
Discussion options

You must be logged in to vote

Hi! Quaternions don't represent the Euler angles, they represent the 'orientation' of the object. Because of this, these two rotations are actually identical Quaternion.Euler(0, 0, 360) == Quaternion.Euler(0, 0, 0) and the tween will do nothing. For the same reason, it's impossible to animate rotations beyond 180 degrees using Quaternions.

To address this, there is the Tween.EulerAngles() method in PrimeTween that can animate the eulerAngles property. It can be used to animate loading indicator like this:

Tween.EulerAngles(loadingIndicatorTransform, Vector3.zero, new Vector3(0, 0, 360), 1, Ease.Linear, -1);

Please see more info in this post.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by benjaminZarate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
FAQ
Labels
None yet
2 participants