I’m trying to set my game up so I can turn my camera around with only moving my mouse and not having to hold left click like a basic FPS. I found one playground link on how to do this and it mostly works, but now I think the program is stuck inside some function when I hold the pointer down. I’m not sure how to make the game continue rendering new frames when I am holding left click, right click, or middle click. Here is a playground link that demonstrates that exact issue. https://www.babylonjs-playground.com/#PLW9V9#19
Well first, hello and welcome
The PG seems to work well for me. What should I do to see the issue? Is it related to only one browser or do you see the issue on all?
This issue happens to me on Firefox. I had no idea this could be a browser issue, but it is working properly on Chrome. So I need to find a way to fix the issue on Firefox.
I also just noticed the issue isn’t exactly as I described in my original post. The real issue is just that when I hold down a mouse button, I can’t move my camera around. And this is only happening in Firefox for me.
I can not repro in Firefox either @beloved community, can somebody else repro ?
Else I would guess one of your extension in the browser might be responsible for it.
Here is another user that complains about this issue on Github: Cannot move camera if mouse button down while pointer locked in Firefox · Issue #7797 · BabylonJS/Babylon.js · GitHub. There is another babylon link that demos the same issue in that link.
Here is another user: Firefox pointerlock + mousemove + mousedown behavior - Questions - Babylon.js
They posted a potential solution but I couldn’t get it working.
Seems like for most people the issue is broken.
Adding @PolygonalSun as he is our input expert
Lemme take a look and see what’s going on
I am able to repro this issue on Firefox 80.0.1 and 81.0.
I got it working by using
scene.attachControl. Here is a playground link where it works for me. Babylon.js Playground Downside is I need to manually code movement buttons instead of relying on the babylonjs to do that for me.
So here’s what I’ve found so far. It looks like looking script is using the “mousemove” event to react to user input. The reason why this is relevant is that, specifically with Firefox, only a “pointermove” event is being fired off when a pointer is down. Since there are no “mousemove” events when pointerdown is active, this leads me to believe that something may need to be done to listen for and handle pointermove events with Firefox.
Cool. This issue has been visited before, in case anyone cares.
2016, 2018, 2019 and now… 2020.
I wasn’t going to mention it, but @timetocode said…
It seems… it’s the future.
Oh yeah, hi xav, welcome aboard, and sorry if no solutions have been found, yet.
Firefox/Mozilla MIGHT be “holding a hard line” on this… because of what they say in the 3rd paragraph… here.
“hardware-agnostic”. A pointer… can be generated/directed by ANY/MANY devices.
Conversely, a mouse… is a specific hardware device.
They’re correct, I suspect. An interesting situation.