控制Unity3D中的旋转路径

时间:2018-01-12 14:06:09

标签: unity3d rotation quaternions

在我自上而下的2.5D射击游戏中,我使用Quaternion.LookRotation()Quaternion.Lerp()来改变播放器的旋转方式。
播放器旋转得很好,但我需要更多控制旋转路径。
这里的问题是LookRotation()总是返回完成旋转的最短路径。我需要播放器始终只在X轴上旋转,直到它为+90或-90,然后在Y轴上翻转到另一侧。
如果玩家在X轴上旋转+或 - 90度并不重要,但想法是在从1帧翻到另一帧之前始终在X轴上旋转,然后在X轴上再次旋转朝着点击。

以下是一些说明上述内容的图片。下面红色的“X”是“点击”发生的地方。

The X marks where the click happened
The player turns on the x-axis only
When the x-axis is either = or - 90 degress the player flips on the y-axis
Finish rotating towards the click on the x-axis

0 个答案:

没有答案