我想 lerp 旋转到 new Quaternion(0,0,0,0);
但它似乎根本没有动画到所需的旋转......它只是停在它所在的地方......
我试的是下面那三个
RectTransform rectTransformComponent = this.transform.GetComponent<RectTransform>();
rectTransformComponent.localRotation = Quaternion.Lerp(rectTransformComponent.localRotation, new Quaternion(0,0,0,0), 0.1f);
和
this.transform.localRotation = Quaternion.Lerp(this.transform.localRotation, new Quaternion(0,0,0,0), 0.1f);
和
this.transform.rotation = Quaternion.Lerp(this.transform.rotation, new Quaternion(0, 0, 0, 0), 0.1f);
我正在为此对象使用 RectTransform。它工作时没有麻痹。它在 Update() 中,所以它会在每一帧循环。我试图提高 lerp 的速度,但没有运气......
有人知道发生了什么事吗??
this.transform.localRotation = new Quaternion(0,0,0,0) //This works
最佳答案
全零四元数 (new Quaternion(0,0,0,0)
) 是无效旋转。 Quaternion.Lerp
不知道如何对无效旋转进行插值。
要旋转到 x=0,y=0,z=0 的欧拉旋转,那么您应该改用 Quaternion.identity
(相当于 new Quaternion(0, 0,0,1)
)。
关于c# - Quaternion.Lerp 甚至没有移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46410965/