Camera Rotate Change in Full Screen?

Hello Everyone,

In the default editor mode, rotating the camera requires left click hold. However, when you switch to full screen under options, the camera auto-rotates with mouse movement.

Select options, then full screen:
https://www.babylonjs-playground.com/#QYFDDP#1

I searched the documentation and the code, and I’m not seeing why that change would occur. :thinking: I would like for the full screen camera to behave the same way it does in editor mode (rotate only with left click hold).

Hi. This is happening because of PointerLock
Try this - line 73
https://www.babylonjs-playground.com/#QYFDDP#416
https://doc.babylonjs.com/api/classes/babylon.engine#enterfullscreen

1 Like

Hello @MarianG, and thanks for taking a look at this. Even with the added line of code in the new PG, entering full screen mode switches camera rotation to mouse movement (same as before). Could this be something unique to Chrome or some other setting?

Hm, I don’t think it is related to browser.
Even the playground is not working as expected, or the pg is good, but it is not working on your project?

When I open any PG to edit (code on the left, scene on the right), the camera only rotates with left click down. But, when I open full screen mode, the camera starts to rotate freely with any mouse movement, and there doesn’t seem to be any way to stop that :thinking:

You mean by clicking on the button in the toolbar ???

It would be normal as pointer lock is true. You should pass it to false as @MarianG mentionned to prevent this behavior and create your own interactions to call into it.

Hello @sebavan. Yes, I’m switching to full screen using options in the tool bar. Should the PG that @MarianG created not have free mouse/camera rotation in full screen? The new line of code added (engine.enterFullscreen(false)) didn’t seem to change anything (camera still rotates automatically with mouse movement in full screen).

nope it can not change it as it is part of the playground code itself.

To see it in action click the run button a second time in @MarianG pg. (it can not work on first run as it requires a user interaction)

I see. When entering full screen mode, there are no options for the user (like the run button in edit mode). All I see are the cubes rotating with mouse movements. Is there a way for the camera to behave exactly as it does in the editor when first entering full screen mode?

Not in the playground let add @PatrickRyan and @PirateJC to see what UX they prefer lock or unlock by default ???

I won t add both so pick only one :slight_smile:

I think it makes sense for them to be consistent. Given that most people probably develop in the playground WITHOUT full screen mode, I’m guessing that the behavior most people will be familiar with is to click to rotate as @Anderson34 first expected. So it would make sense to me that we would be consistent with the most expected behavior…basically when in full screen mode, it should also click to rotate. That’s just my 0.02…maybe 0.01 LOL

1 Like

Ok done this will be in the nightly tomorrow.

1 Like

Yes, that’s exactly right @PirateJC. I’ve been working on a project for months in the editor, so when I recently switched to full screen for the first time, I was surprised to see the camera change, and it wasn’t clear how to change it. Thanks to everyone for taking the time to help! :smiley: :+1:

2 Likes

Hello again @sebavan and @PirateJC.

I’m still trying to replicate the editor mode camera and cursor controls in full screen mode. I understand the change occurs due to the default enabling of pointer lock. In the PG below, I disable pointer lock with keydown, but that results in losing the pointer icon and the ability to move the camera with left click hold (the defaults for editor mode). It seems there might be other settings to adjust other than pointer lock to achieve this goal (i.e. move camera only with left click hold).

https://www.babylonjs-playground.com/#XSUMEK

I am not totally sure I understand your issue here :frowning:

The behavior seems the same in your playground on full screen and not full screen. I am not seeing differences anymore. Could you detail a bit more the issue ? just to help me understanding it better. It s Monday I might be slow to start :slight_smile:

Hello @sebavan,

Thanks for responding–I’ll try to explain the issue more clearly.

Here are the conditions in editor mode (split screen):
-Pointer lock is off by default (camera does not move with mouse movements).
-Cursor is visible always.
-Left click hold allows camera movements.

Here are the conditions when I switch to full screen (using the toolbar “options” icon):
-Pointer lock is automatically on and remains on (camera moves with mouse movements).
-Cursor disappears.

My goal is to have editor mode and full screen mode behave exactly the same with respect to pointer lock, camera movement, and cursor visibility.

I am so sorry but I can not repro :frowning: On Chrome Win Desktop since the fix they behave exactly the same. You should try ctrl+F5 just to be sure it is not your cache.

You should even try with https://playground.babylonjs.com/ the default one.

And let me know if you still have the same issue and your OS/Browser cause it might be related.

The default PG you recommended (playground.babylonjs.com) works correctly, but not the PG found here: babylonjs-playground.com :thinking: Also, all PG’s work correctly with Edge, so maybe this is a Chrome issue?

Update: Clearing Chrome cache fixed the issue. :smiley: :+1:
Thanks again for the help!