LuckyEcho

Untitled

May 23rd, 2024
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. // Get input and do some calculations on it.
  2. MouseX = playerControls.Gameplay.Look.ReadValue<Vector2>().x * CameraSensitivity;
  3. MouseY = playerControls.Gameplay.Look.ReadValue<Vector2>().y * CameraSensitivity;
  4.  
  5. if (invertLook)
  6. {
  7. MouseX = -MouseX;
  8. MouseY = -MouseY;
  9. }
  10.  
  11. cameraRotX += MouseX;
  12. cameraRotY -= MouseY;
  13.  
  14. cameraRotY = Mathf.Clamp(cameraRotY, -MaxLookAngle, MaxLookAngle);
  15.  
  16. // Assign the rot values.
  17.  
  18.  
  19. CameraHolder.transform.rotation = Quaternion.Lerp(CameraHolder.transform.rotation, Quaternion.Euler(cameraRotY, cameraRotX, 0), Time.deltaTime * cameraSmoothing * cameraDivisionAmount);
  20. armsObject.transform.rotation = Orientation.transform.rotation;
  21. Orientation.transform.rotation = Quaternion.Euler(0, cameraRotX, 0);
  22. PlayerModel.transform.rotation = Orientation.transform.rotation;
Advertisement
Add Comment
Please, Sign In to add comment