Unity 3D 想让模型按D自身旋转绕Y轴旋转90度,但是运行的时候会变180度,求解决

2025-03-23 14:27:48
推荐回答(1个)
回答1:

if (Input.GetKey(KeyCode.D))
{
this.transform.localRotation.y=90;
}

这句话是否写在OnGUI方法里面去了,如果是,请写回Update方法中。
没有的话,就改变一下
transform.Rotation(Vector3.up*90)