La rotación puede seguir la dirección de movimiento, la cámara o el mouse.
if (direccion.sqrMagnitude > 0.001f)
{
transform.forward = direccion;
}
Quaternion rotacionObjetivo =
Quaternion.LookRotation(direccion);
transform.rotation = Quaternion.Slerp(
transform.rotation,
rotacionObjetivo,
velocidadRotacion * Time.deltaTime
);
transform.rotation = Quaternion.RotateTowards(
transform.rotation,
rotacionObjetivo,
gradosPorSegundo * Time.deltaTime
);
Para personajes 3D normalmente querés evitar inclinar el objeto.
Vector3 direccionPlano = new Vector3(
direccion.x,
0f,
direccion.z
);
Si usás Rigidbody, puede ser conveniente rotar con:
rb.MoveRotation(rotacionObjetivo);
dentro del flujo físico.