Camera Jumping When Locking Mouse

I am making a camera system with the mouse locked in the center, so the camera follows the mouse without right click. It returns to default behavior when the player opens their inventory. My issue is that when I close the inventory and it locks again, if the mouse is moving and is far away from the center of the screen, it detects it as a mouse input with a large mouse delta, and the camera flicks around

Is there any way to suppress mouse movement detection momentarily, or freeze the mouse, or something?

2 Likes