Eonirr

Untitled

Mar 5th, 2025
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. float yRotation = inputDirection.x * Time.fixedDeltaTime * speedMult * rotaRatio;
  2. Quaternion turnRotation = Quaternion.Euler(0f, yRotation, 0f);
  3. rb.MoveRotation(rb.rotation * turnRotation);
  4.  
  5. float turnAmount = inputDirection.x;
  6. float maxAngle = 20f;
  7. float tiltAngle = Mathf.Clamp(turnAmount, -maxAngle, maxAngle);
  8.  
  9. Vector3 newEulerAngles = new Vector3(rb.rotation.eulerAngles.x, rb.rotation.eulerAngles.y, tiltAngle);
  10. rb.MoveRotation(Quaternion.Euler(newEulerAngles));
Advertisement
Add Comment
Please, Sign In to add comment