How to get mouse to lock when holding down right mouse button

I have a third person camera system where when you hold down right mouse button it moves the third person camera, I also have a cursor that disappears when right mouse button is held and is visible again when right mouse button is released. The problem is when the mouse is released its in an entirely different location then it was when I pressed it. Basically I want my mouse to stay in the same position when right mouse button is held.

Hi!

The mouse position doesn’t “lock”, because then you wouldn’t be able to look around. But there is a workaround with saving the initial position when you start to move the camera:

When you do the rightclick to move the camera you need to get the mouse position and then save it in a vector variable, then when you release right-mousebutton you need to set the mouse position using the vector variable.

Could you send an image by chance? I’m pretty new to unreal and I just need a picture of what you mean and I should be able to do it.