dotween icon indicating copy to clipboard operation
dotween copied to clipboard

DORotate RotateMode.FastBeyond360 rotating backwards

Open thsbrown opened this issue 2 years ago • 3 comments

I'm wondering if DORotate RotateMode.FastBeyond360 is working properly. Given my understanding (which could definitley be wrong) FastBeyond360 should not rotate backwards. Yet when I set this flag I still seem to be rotating backwards taking the shortest path.

Am I missing something with my implementation or is this a bug. Part of the reason I'm asking is due to seeing this issue

thsbrown avatar Aug 22 '22 23:08 thsbrown

Here is a gif demoing my issue. The yellow meteor as I understand it should rotate forwards rather than backwards given the RotateMode.FastBeyond360 flag. At least I think 😅. 2D1F7269-D381-4B82-A575-18F173E508B2 And here is the code that produces it :)

  var planetRotateToStartPositionsSequence = DOTween.Sequence();
  planetRotateToStartPositionsSequence.Append(
      earth.value.transform
          .DORotate(
              new Vector3(0, 0, selectedLevelInstanceData.value.associatedLevelData.startingEarthRotation),
              speedToStartPlanetRotation, RotateMode.FastBeyond360)
          .SetEase(planetRotationEase));
  planetRotateToStartPositionsSequence.Insert(0,
      selectedLevelInstanceData.value.goalMeteor.transform.DORotate(
          new Vector3(0, 0, selectedLevelInstanceData.value.associatedLevelData.startingGoalMeteorRotation),
          speedToStartPlanetRotation, RotateMode.FastBeyond360)
      .SetEase(planetRotationEase));
  planetRotateToStartPositionsSequence.AppendCallback(() =>
  {
      selectedLevelInstanceData.value.missile.transform.SetParent(null,true);
      selectedLevelInstanceData.value.missile.missileActivator.Activate();
      cinemachineLevelVirtualCamera.value.Follow = selectedLevelInstanceData.value.missile.transform;
      Finish();
  });
  planetRotateToStartPositionsSequence.AppendInterval(delayAfterPlanetStartRotationsReached);
  planetRotateToStartPositionsSequence.OnComplete(() =>
  {
      earthPhysicsSpin2D.StartSpin();
      goalMeteorPhysicsSpin2D.StartSpin();
  });
  planetRotateToStartPositionsSequence.Play();

Thanks for any help in advance!

thsbrown avatar Aug 23 '22 00:08 thsbrown

Putting 360° as the rotation without using RotateMode.FastBeyond360 wont rotate the object, because 360° is same as 0°. Adding RotateMode.FastBeyond360 allows u to not consider 360° equal to 0° and that means actually rotating 360°. From my understanding, thats what FastBeyond360 does.

If i have to guess, i would say its something related to the order of tweening/rewinding, i often get something like this, only to find that i was tweening the same object right before the current tween is finished, making it look like this. Like calling DoMoveY while DoPunchPosition is running

Joknaa avatar Oct 04 '22 20:10 Joknaa

I have something similar going on. I had an object that keeps rotating on player input, and it was rotating on y axis. The RotateMode was the standard one, RotateMode.Fast. I kept the same code and just changed the axis, and now its behaves the same way your object does. Even if I use RotateMode.FastBeyond360, nothing changes.

pbelluzzo avatar Jan 31 '23 21:01 pbelluzzo