How do you stop the mousemovement in a fps game, when I'm in the pause Menu or smth like that?

Pls i tried my best but cloud’nt get it

If your values are being multiplied by Time.deltaTime then setting time scale to 0 will effectively ‘turn off’ mouse movement.

You can also disable/enable the component updating the FPS camera when the pause menu is opened or closed, or simply guard the code from running if the game is paused:

private void Update()
{
    if (PauseMenu.GameIsPaused == true)
    {
        return;
    }
    
    // rest of code
}

Lets say, for example you have some Input reading code:

Movement = new Vector3 (Input.GetAxisRaw ("Horizontal"), Input.GetAxisRaw ("Vertical"),0);

All you need is a bool. Let’s call it “AcceptInput”. Then wrap your input code in an if statement

if (AcceptInput)
{
   Movement = new Vector3 (Input.GetAxisRaw ("Horizontal"), Input.GetAxisRaw ("Vertical"),0);
}

Then all you have to do is set AcceptInput to “false” when you want to turn input off, then set it to “true” when you want to turn it back on.

1 Like