【发布时间】:2019-04-26 21:58:39
【问题描述】:
我试过这个,但是每次按下显示屏时,相机都会从这个点开始。
所以我现在不知道该怎么办
我试过用夹子做一些,但是出错了
if(Input.GetTouch(0).phase == TouchPhase.Began )
{
firstpoint = Input.GetTouch(0).position;
???xAngTemp = Mathf.Clamp(xAngle, 10, 10);
???yAngTemp = Mathf.Clamp (yAngle, 10, 10);
xAngTemp = xAngle;
yAngTemp = yAngle;
}
if(Input.GetTouch(0).phase==TouchPhase.Moved)
{
secondpoint = Input.GetTouch(0).position;
???xAngTemp = Mathf.Clamp(xAngle, 10, 10);
???yAngTemp = Mathf.Clamp (yAngle, 10, 10);
//Mainly, about rotate camera. For example, for Screen.width rotate on 180 degree
xAngle = xAngTemp + (secondpoint.x - firstpoint.x) * 30 * XSensitivity / Screen.width;
yAngle = yAngTemp - (secondpoint.y - firstpoint.y) * 15 * YSensitivity / Screen.height;
//Rotate camera
this.transform.rotation = Quaternion.Euler(yAngle, xAngle, 0.0f);
}
【问题讨论】:
-
你能解释一下你想要什么吗?!夹相机是什么意思?
-
我的意思是让相机只旋转90度