So this is basically the code of Unity’s Stealth Tutorial
void Rotating(float horizontal, float vertical)
{
// Create a new vector of the horizontal and vertical inputs.
Vector3 targetDirection = new Vector3(horizontal, 0f, vertical);
// Create a rotation based on this new vector assuming that up is the global y axis.
Quaternion targetRotation = Quaternion.LookRotation(targetDirection, Vector3.up);
// Create a rotation that is an increment closer to the target rotation from the player's rotation.
Quaternion newRotation = Quaternion.Lerp(rigidbody.rotation, targetRotation, 8f * Time.deltaTime);
// Change the players rotation to this new rotation.
rigidbody.MoveRotation(newRotation);
}
As you can see this function takes the horizontal and vertical axis input to create a new vector and set it as the target direction which works fine, but this codes expects that the camera will always look in the direction of Vector3.forward, this is the global system.
By locally I mean that no matter which direction the camera is looking the player will always rotate to the direction your axis is being input.
Beautiful, that did it, thank you.
– Limbo