Unity 物体旋转
void RotateCamera()
{
float h = Input.GetAxis("Mouse X");
//Debug.Log(h + "______________");
transform.RotateAround(transform.position, Vector3.up, h * RotateSpeed * 4);
float V = Input.GetAxis("Mouse Y");
//Debug.Log(V + "______________");
V = Mathf.Clamp(V, -4, 4);
float x = transform.localEulerAngles.x;
if ((V > 0 && ((x < 90 || x > 300))) || (V < 0 && (x < 60 || x > 270)))
{
transform.RotateAround(transform.position, transform.right, -V * RotateSpeed * 4);
}
}

浙公网安备 33010602011771号