Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.34k stars 351 forks source link

DORotate RotateMode.FastBeyond360 rotating backwards #595

Open thsbrown opened 2 years ago

thsbrown commented 2 years ago

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 commented 2 years ago

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!

Joknaa commented 2 years ago

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

pbelluzzo commented 1 year ago

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.