【发布时间】:2015-02-20 18:38:17
【问题描述】:
好的,这是我的代码:
float temp1 = Mathf.Sin(Input.mousePosition.x - Screen.width / 2);
float temp2 = Mathf.Cos(Input.mousePosition.y - Screen.height / 2);
Camera.mainCamera.transform.parent.transform.Rotate(temp1,temp2,0);
因此,我尝试根据鼠标与相机父级之间的角度旋转相机的父级。除了我做错了什么,有人可以帮帮我吗?
提前致谢!
【问题讨论】:
-
嗯,你可能需要在减法周围加上括号。除法具有更高的优先级。
-
好的,我这样做了,但现在它转向完全相反的方向
-
1) 怀疑你想要
float angle = arctan2f(Input.mousePosition.y - Screen.height / 2, Input.mousePosition.x - Screen.width / 2); (Change radians to degrees if needed) Camera.mainCamera.transform.parent.transform.Rotate(angle);。但这不在我的wheelhouse 范围内。 -
建议在帖子中添加标签
Unity3D而不是标题。
标签: unity3d trigonometry