Description:
I’m encountering an issue with rotation using Dotween’s DOLocalRotateQuaternion() function. Currently, this method restricts rotations to a maximum of 180 degrees, taking the shortest path. However, I need to achieve full rotations (360 degrees).
Problem:
I’m creating step-by-step animations in a script for a WebGL build. Each animation step involves rotation, and I need these rotations to exceed 180 degrees. When using DOLocalRotateQuaternion(), rotations beyond 180 degrees take the shortest path, which is not suitable for my requirements.
Even I tried DOLocalRotate() but in this case it getting gimbal lock issue, Rotation happen unusally.
Requirements:
I want to rotate objects freely beyond 180 degrees using Dotween.
Each animation step involves rotating the object left or right based on user input values, which can exceed 360 degrees.
Example Scenario:
Rotate the object to the right with a rotation value greater than 360 degrees.
Save this rotation as the first animation step.
Rotate the object to the left with another rotation value (which can also exceed 360 degrees) and save it as the second animation step.
When the “Play Animation” button is clicked, the animations should play step by step based on the saved rotation values.
Request:
I’m seeking advice or alternative methods to achieve full rotations with based on the user direction using Dotween in Unity, especially for WebGL builds where animations are scripted step by step.
Any help or suggestions would be greatly appreciated! Thank you.
Check out RotateMode and use FastBeyond360 (I’m not a user, I’m judging from what I see in the docs)
Yes, I tried DOLocalRotate() → FastBeyond360 , but that is I am facing Gimbal lock issue , if x=0,y=100,z=0, it’s rotated fine but if x=95,y=100,z=0, now rotation happening unusually
Unfortunately I can’t help you further because that would require me to actually work with Dotween. So I can only speculate.
In my attempt to help you I’ve seen several such topics already discussed here and on StackOverflow and elsewhere.
You can also think about nesting the objects, so that the end-point object (the leaf) has strictly Y rotation and the parent is then free to orient independently without introducing any complications to this tween.
Another way to think about it would be to construct valid two quaternion rotations and then instead of tweening a rotation, you tween some value t
(a float), and use Quaternion.Slerp to interpolate between two quaternions. Slerp is still looking for a shortest distance, but you may deconstruct your rotations into a chain of 180s (or 90s).
If your end-point rotation is strictly planar (meaning on one axis as in 2D) then you can make this rotation on your own, although this requires some knowledge on trigonometry (I can help). In this case you can use arbitrary angles, because the actual tween only drives this one angle as a value.
Try this place
I didn’t really understand your problem with the writing alone, but in my experience, the rotational issues were not a big problem with the addition of FastBeyond360 or Axis-related options.