【发布时间】:2020-05-18 18:51:51
【问题描述】:
如果我按下 A/D,我有一个角色沿着 x-world-axis 移动,如果我按下 W/S,我将沿着 z-world-axis 移动。
我希望我的角色朝他移动的方向看。例如。如果玩家按下“D”,角色应该向右看。
我的脚本看起来像:
Vector3 moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical"));
moveDirection *= moveSpeed;
...
等等。
将角色旋转到他当前移动方向的最佳方法是什么?
【问题讨论】:
-
我不使用 Unity,但也许这会回答你的问题:stackoverflow.com/questions/28648071/rotate-object-in-unity-3d
-
@MikeH 不是我想要的。