Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float yRotation = inputDirection.x * Time.fixedDeltaTime * speedMult * rotaRatio;
- Quaternion turnRotation = Quaternion.Euler(0f, yRotation, 0f);
- rb.MoveRotation(rb.rotation * turnRotation);
- float turnAmount = inputDirection.x;
- float maxAngle = 20f;
- float tiltAngle = Mathf.Clamp(turnAmount, -maxAngle, maxAngle);
- Vector3 newEulerAngles = new Vector3(rb.rotation.eulerAngles.x, rb.rotation.eulerAngles.y, tiltAngle);
- rb.MoveRotation(Quaternion.Euler(newEulerAngles));
Advertisement
Add Comment
Please, Sign In to add comment