如何旋转我的角色?

How To Rotate My Character?

我正在尝试使用此方法来替代制作其他 2 个动画。 我试图让图片不言自明。我想要做的就是想办法让我的角色在按下右键时向右旋转约 90 度,而在按下左键时向左旋转约 90 度。我试过 Quaternion.RotateTowards 和 Quaternion.Slerp,但对我无济于事。 谢谢:)

This should make it more clear

您是否尝试过使用角色的变换对象使用 Transform.Rotate 函数?

http://docs.unity3d.com/ScriptReference/Transform.Rotate.html

我想这样的事情应该可行:

var direction = Mathf.Sign(Input.GetAxis("Horizontal")) * 90f;
transform.localRotation = Quaternion.Euler(0, direction, 0);