unity-tweens icon indicating copy to clipboard operation
unity-tweens copied to clipboard

360 rotation tween functions don't work.

Open FullStackForger opened this issue 3 years ago • 1 comments

Describe the bug 360 rotation tweens doesn't seem to be working.

To Reproduce Steps to reproduce the behavior:

  1. Create an object in the scene.
  2. run TweenLocalRotationX function on it, eg:
gameObject.TweenLocalRotationX(360f, 1f).SetEaseBackIn()

Expected behavior Object should rotate 360 degrees around x Axis over 1000ms.

Screenshots N/A

Desktop (please complete the following information):

Smartphone (please complete the following information): N/A

Additional context N/A

FullStackForger avatar Aug 18 '22 06:08 FullStackForger

Yes I've just come across this as well. Can't rotate past 180 or -180 when using TweenLocalRotationZ on a RecTransform OS: windows Version: Latest

RyanJVR avatar Sep 12 '22 14:09 RyanJVR

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Oct 13 '22 02:10 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Oct 28 '22 02:10 github-actions[bot]

small bump to reopen it perhaps?

FullStackForger avatar Nov 24 '22 23:11 FullStackForger

@jeffreylanters I'm seeing this issue as well, I believe it's related to the use of Quaternion.Euler with values greater than 180.

derek-vellocet avatar Feb 11 '23 01:02 derek-vellocet

For anyone with this issue, as a workaround you can just tween a float value and manually assign the rotation.

this.TweenValueFloat(360.0f, 1.0f, value =>
{
    this.transform.localRotation = Quaternion.Euler(Vector3.one * value);
});

derek-vellocet avatar Feb 11 '23 01:02 derek-vellocet

This is intended behavior, since when an object is rotated to for example to 355, and you want it to go back to 0, you most likely don't want it to rotate back a full circle, but rather just the 5 degrees. Otherwise you'd had to keep track of its rotation all the time in order to prevent this from happening.

Derek's solution is the way to work around this. But I will look into an option to disable this behavior in the near future.

jeffreylanters avatar Feb 11 '23 06:02 jeffreylanters