【发布时间】:2021-05-29 14:28:22
【问题描述】:
所以这是我的问题:我在 Unity 中有一个对象,即我的 Player。 我希望这个玩家能够面对他移动的方向。 但我不知道如何旋转对象,直到释放特定键然后将旋转重新定位到 0,0,0
我试过这个代码
public class PlayerAction : MonoBehaviour
{
public float horizontalInput;
public float verticalInput;
// Start is called before the first frame update
void Start()
}
// Update is called once per frame
void Update()
{
horizontalInput = Input.GetAxis("Horizontal");
verticalInput = Input.GetAxis("Vertical");
if (horizontalInput > 0)
{
transform.Rotate(0, 90, 0);
}
}
}
我在看四元数,但在任何论坛上什么都不懂。
为了澄清我想手动更改播放器的旋转
【问题讨论】:
标签: unity3d input rotation transform quaternions