Eonirr

Untitled

Mar 5th, 2025
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 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, maxAngle);
  8.  
  9. Quaternion tiltRotation = Quaternion.AngleAxis(tiltAngle, transform.forward);
  10. rb.MoveRotation(rb.rotation * tiltRotation);
Advertisement
Add Comment
Please, Sign In to add comment