I’ve been learning Unreal for about three months now, and I never understood very well the way mouse focus works until I saw this great tutorial by Paul Gestwicki: Managing mouse input by changing player controller input modes in UE4 - YouTube
I was finally able to understand how mouse capture works related to player controllers and nodes and all that, and anyone getting started should watch it. Basically this puts a main level on game load that has a button to start the game, with normal and hovered states. If done correctly, when the game loads, you should see the mouse pointer and a button on the center that says Start Game, which when you hover over changes slightly, and if you press it, it loads the game level, where you don’t see the mouse pointer anymore, and the mouse is fully captured by the game, so you can look around in all directions and the mouse pointer won’t stop you because you don’t see it, but also because the game captured it. Then if you press Q, you will go back to that first menu with the button, and you can go back and forth as much as you want. Every time you’re in the menu, you see the pointer, and every time you press the button, the pointer disappears. This behavior is exactly what I need for my game.
My only problem, and I know this is because of the HTML5 implementation, is that Paul’s method works flawlessly inside the editor’s preview, but as many other things, it breaks when exported to HTML5, which unfortunately, it’s the platform I need.
I was very surprised that with this method, I was able to achieve something that I had never achieved before, which is that when I launch that server inside the HTML5 build and I load the game in the browser, I’m able to see the hovered state just by hovering over the button, which is something I had never seen before in my hundreds of HTML5 exports the past few months.
But unfortunately, as soon as I press the button, it opens the game level but the pointer is still visible and the mouse is not captured because if I move it to the edges of the screen, lookaround motion stops.
Is this because it’s a restriction of HTML5 or is there anything I can do to make it capture the mouse when I click the Start Game button? I’ve been trying so many things since I found this tutorial yesterday and nothing works. If anyone has any suggestions please let me know.