我正在创建一个360度观众,我想在陀螺仪和触摸之间交替。我已经全部工作,但想要改善我有点卡住的触控。我正在使用此代码:
float x = Input.GetTouch(0).deltaPosition.x;
float y = Input.GetTouch(0).deltaPosition.y;
float speed2 = 0.09f;
this.transform.localRotation *= Quaternion.AngleAxis(x*speed2, Vector3.up);
this.transform.localRotation *= Quaternion.AngleAxis(y*speed2, Vector3.left);
它工作得很完美,但我想阻止z轴,以防止在移动手指制作对角线或尝试旋转180º时出现奇怪的视图。我尝试了一些代码,但没有运气。
非常感谢!