#pragma strict var smooth=2.0; var tiltAngle=30.0; function Start () { } function Update () { transform.position.x=(Input.mousePosition.x-Screen.width/2)/(Screen.width/2); transform.position.z=(Input.mousePosition.y-Screen.height/2)/(Screen.height/2); Debug.Log(transform.position.x); var tiltAroundZ=Input.GetAxis("Mouse X")*tiltAngle; var tiltAroundX=Input.GetAxis("Mouse Y")*tiltAngle-2; var target=Quaternion.Euler(tiltAroundX,0,tiltAroundZ); transform.rotation=Quaternion.Slerp(transform.rotation,target,Time.deltaTime*smooth); }