- Home /
DOTween transform.DORotate() weird behaviour?
Using the tween engine DOTween , I'm trying to make a cube rotate 90 degrees.
My code looks like this:
using UnityEngine;
using DG.Tweening;
public class Cube : MonoBehaviour {
public void Rotate()
{
gameObject.transform.DORotate(transform.eulerAngles + Quaternion.AngleAxis(90, Vector3.up).eulerAngles, 1);
}
}
Now when I go to test this, it works fine, see this gif
But when I want to modify the code so that it rotates on the x axis instead of the y axis : gameObject.transform.DORotate(transform.eulerAngles + Quaternion.AngleAxis(90, Vector3.right).eulerAngles, 1);
The rotation works fine for the first 2 manipulations, and then it reverses and gets stuck between only 2 position instead of going all the way back to its original orientation, see this
What am i doing wrong?
Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220612150845im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
DOTween & how to undo SetBlendableScaleBy tweens that get killed 0 Answers
Cannot tween camera to a nice smooth stop. 1 Answer
LeanTween reverse tween 1 Answer
Tweening is not consistent 0 Answers