物体跟随鼠标旋转

**

物体跟随鼠标旋转

**

Mathf.Clamp(,)把数值限制在最大和最小之间,value小于min返回min,大于max,返回max

	    private float maxYRotation = 120;
	    private float minYRotation = 0;
	    private float maxXRotation = 60;
	    private float minXRotation = 0;
 		 float xPosPer = Input.mousePosition.x / Screen.width;`//鼠标在x方向于屏幕的比例`
        float yPosPer = Input.mousePosition.y / Screen.height;//鼠标在y方向于屏幕的比例
        float xAngle = -Mathf.Clamp(yPosPer*maxXRotation,minXRotation,maxYRotation)+15;
        float yAngle = Mathf.Clamp(xPosPer * maxYRotation, minXRotation, maxYRotation) - 60;
        transform.eulerAngles = new Vector3(xAngle,yAngle,0);
上一篇:断点续传@Ubuntu: aria2


下一篇:3D图形学在游戏开发中的,矩阵,四元数,欧拉角之间的底层转换算法。