我想在 Z 轴上以特定的角度、速度和方向旋转对象,然后停止。
这是我的代码:
Quaternion targetRotation = Quaternion.AngleAxis(currentRotation.rotateValue, Vector3.forward);
float step = currentRotation.speed;
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, step);
有了这个,我可以以所需的速度和角度移动,但方向不正确。我所做的是在它达到 180 后将它移动 180 我将它移动 360,这是一个循环。问题是在 360 度之后不是顺时针移动,而是逆时针移动。不知道这里发生了什么需要绝望的帮助。
提前致谢。