[SOLVED] How To Make First Person Camera Mouse Down Run In Only Certain Condition

I want the First Person Movement camera to only work when you’re in the level. But the problem is that the mouse cursor goes away whenever you click the screen. This is okay within gameplay in the level, but it causes problems when you try clicking buttons in the UI. It ignores your click and proceeds to run as if your still playing the level. I’ve tried a lot of stuff, but the problems still doesn’t go away. Does anyone know if my code is wrong, or if there’s a way to fix this problem?

Link To Editor: https://playcanvas.com/editor/scene/874020

Hi @GmeMkr,

Here is the line that locks the mouse pointer to the screen:

this.app.mouse.enablePointerLock();

You can use this method and the disablePointerLock to swap this behavior.

https://developer.playcanvas.com/en/api/pc.Mouse.html#disablePointerLock