Advertisement
Guest User

Untitled

a guest
Feb 15th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. void LateUpdate()
  2.     {
  3.         float mouseX = Input.GetAxis("Mouse X") * mouseSense * Time.deltaTime;
  4.         float mouseY = Input.GetAxis("Mouse Y") * mouseSense * Time.deltaTime;
  5.  
  6.         xRotation -= mouseY;
  7.         xRotation = Mathf.Clamp(xRotation, pitchMinMax.x, pitchMinMax.y);
  8.  
  9.         playerBody.Rotate(Vector3.up * mouseX);
  10.  
  11.         //transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f); // Rotates only from camera perspective, I want it to rotate       around playerBody
  12.         transform.RotateAround(playerBody.position, new Vector3(mouseY, 0f, 0f), mouseSense * Time.deltaTime); // This is the best shot I've had
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement