TeHArGiS10

Untitled

Aug 8th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. //Camera
  2. float xRot = Input.GetAxisRaw("Mouse Y");
  3. float yRot = Input.GetAxisRaw("Mouse X");
  4.  
  5. Vector3 vectorX = new Vector3(xRot, 0, 0) * sensitivity;
  6. Camera.main.transform.Rotate(-vectorX);
  7. Camera.main.transform.localEulerAngles = new Vector3(Mathf.Clamp(Camera.main.transform.localEulerAngles.x, -45, 45), 0, 0);
  8.  
  9. Vector3 vectorY = new Vector3(0, yRot, 0) * sensitivity;
  10. rb.MoveRotation(rb.rotation * Quaternion.Euler(vectorY));
Advertisement
Add Comment
Please, Sign In to add comment