Camera skipping after moving a little bit

I’m noticing a weird behavior on the camera. I’m turning around at a constant speed and after turning a certain amount it’s jumping/skipping a lot.

msedge_PJ1kSgA3ov

The above has

        public void OnLook(InputAction.CallbackContext context)
        {
            lookVector = context.ReadValue<Vector2>() * 0.2f;
        }

It gets way more noticeable/frequent by reducing the sensitivity. But it still happens with the original code.

I have noticed the same issue on online demos.

msedge_cagObeoqUT

What is causing this? What can I do about this?

Hello @Bruno_Leonardo_Miche,

Could you please use Time.DeltaTime?

I think I found the issue. It seems the skip happens when the mouse moves too fast outside of bounds. The horizontal offset here spikes:

I was able to solve this issue by using the normalized vector instead:

Vector2 lookVector = ConvaiInputManager.Instance.lookVector.normalized;

So I replaced the method ConvaiPlayerMovement.RotatePlayerAndCamera

        private void RotatePlayerAndCamera()
        {
            if (Cursor.lockState != CursorLockMode.Locked) return;

            // Get normalized look direction
            Vector2 lookVector = ConvaiInputManager.Instance.lookVector.normalized;

            // Vertical rotation
            _rotationX -= lookVector.y * lookSpeedMultiplier;
            _rotationX = Mathf.Clamp(_rotationX, -lookXLimit, lookXLimit);
            playerCamera.transform.localRotation = Quaternion.Euler(_rotationX, 0, 0);

            // Horizontal rotation
            float rotationY = lookVector.x * lookSpeedMultiplier;
            transform.rotation *= Quaternion.Euler(0, rotationY, 0);
        }

I haven’t had any spikes after changing that.