I am using a rigid body and am freezing the xyz. How do i make it so when i add snap turn and smooth turn the player is not being moved and is staying in that spot. Right now when i do it it makes the player move very slightly
If you’re trying to turn/rotate the rigidbody around the Y axis using AddTorque or setting angularVelocity then you’ll need to unfreeze the Y rotation.
Or you can leave XYZ frozen and use MoveRotation to rotate the rigidbody from within Update. Doing this will feel more responsive but not quite as smooth.
Do u know why it is causing me to move when I rotate instead of turning in place?
private void Turn()
{
// Only apply turning if input exceeds the deadzone threshold
if (Mathf.Abs(turnFlyBoostInput.x) > turnDeadzone)
{
// Calculate the amount to turn based on input, turn speed, and deltaTime
float turnAmount = turnFlyBoostInput.x * turnSpeed * Time.fixedDeltaTime;
// Apply the rotation around the Y-axis to rotate the player in place
playerRigidbody.MoveRotation(playerRigidbody.rotation * Quaternion.Euler(0f, turnAmount, 0f));
}
}
}