我的播放器漂浮在太空中,当它应该左转或右转时,它会沿着z轴旋转
float x = CrossPlatformInputManager.GetAxis ("Horizontal");
float y = CrossPlatformInputManager.GetAxis ("Vertical");
transform.Translate (Vector3.forward * speed * Time.deltaTime);
rigidBody.AddForce (transform.up * flySpeed * Time.deltaTime);
transform.Rotate (new Vector3 (Time.deltaTime * -y * rotateSpeed,
Time.deltaTime* x * rotateSpeed, -Time.deltaTime * -x * rotateSpeed));发布于 2017-03-06 18:28:44
如果你想让你的对象只在z轴上旋转,并且假设你有关联到你的对象的刚体,你可以在检查器中冻结刚体组件的旋转,方法是选中x和y轴上的约束部分。
这样,它只能在z轴上旋转。
https://stackoverflow.com/questions/42621907
复制相似问题