I want to stop my character from rotating with the camera when the character is still. I am not sure what the best way to go about it is. In my character controller I am using the new unity input system and for camera I am using Cinemachine, on my character I have the character controller component.
Here is the rotation code:
// Rotate towards camera direction
float targetAngle = cameraTransform.eulerAngles.y;
Quaternion targetRotation = Quaternion.Euler(0, targetAngle, 0);
transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
and here is the movement code:
Vector2 input = moveAction.ReadValue<Vector2>();
Vector3 move = new Vector3(input.x, 0, input.y);
move = move.x * cameraTransform.right.normalized + move.z * cameraTransform.forward.normalized;
move.y = 0f;
controller.Move(move * Time.deltaTime * playerSpeed);