Hi, I've been having a ton of trouble getting cinemachinefreelook to work with my movement and rotation. I am trying to make a simple platformer and my rotation speed seems to be messed up in turn with my camera rotation. I am using the new unity input system and posting a visual of it, before the square deforms it was jittering and I don't know the right combo of settings to get this to work smoothly.
Simply put I want the camera to be rotatable and the player to rotate on their own too with it all being smooth.
My movement code is inside FixedUpdate():
private void Move()
{
Vector3 moveDirection = new Vector3(moveInput.x, 0f, moveInput.y).normalized;
Vector3 cameraForward = Camera.main.transform.forward;
cameraForward.y = 0;
cameraForward.Normalize();
Vector3 cameraRight = Camera.main.transform.right;
cameraRight.y = 0;
cameraRight.Normalize();
Vector3 desiredDirection = cameraForward * moveDirection.z + cameraRight * moveDirection.x;
rb.velocity = new Vector3(desiredDirection.x * moveSpeed, rb.velocity.y, desiredDirection.z * moveSpeed);
if (desiredDirection != Vector3.zero)
{
Quaternion targetRotation = Quaternion.LookRotation(desiredDirection, Vector3.up);
rb.MoveRotation(Quaternion.RotateTowards(rb.rotation, targetRotation, rotationSpeed * Time.fixedDeltaTime));
}
}
could anyone help with this who may have used this component before?