BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
22.78k stars 3.39k forks source link

Fixing an issue with touch camera initialization #15141

Closed RaananW closed 1 month ago

RaananW commented 1 month ago

The code section make an incorrect assumption -

If mouse exists, disable touch on the mouse, and the same on the touch input, However, it doesn't take into account whether or not touch (or mouse) input is enabled on the camera.

The change here will enable touch on the mouse input if touch is not enabled, and will enable mouse on the touch if mouse module is not available.

Not sure if we should consider this as a bug or a breaking change. I think it is a bug, looking for feedback.

See issue here - https://forum.babylonjs.com/t/the-free-camera-serialization-cannot-save-the-touch-screen-swipe-perspective-information/50715?u=raananw . The serialized camer haas only mouse enabled, so touch is disabled.

Playground ID to test (using touch input or emulated touch device) - #D4DKWL#2

bjsplat commented 1 month ago

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.

bjsplat commented 1 month ago

Snapshot stored with reference name: refs/pull/15141/merge

Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15141/merge/index.html

To test a playground add it to the URL, for example:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15141/merge/index.html#WGZLGJ#4600

Links to test babylon tools with this snapshot:

https://playground.babylonjs.com/?snapshot=refs/pull/15141/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/15141/merge https://gui.babylonjs.com/?snapshot=refs/pull/15141/merge https://nme.babylonjs.com/?snapshot=refs/pull/15141/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/15141/merge#BCU1XR#0

bjsplat commented 1 month ago

WebGL2 visualization test reporter:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15141/merge/testResults/webgl2playwright/index.html

bjsplat commented 1 month ago

Visualization tests for WebGPU (Experimental)

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15141/merge/testResults/webgpuplaywright/index.html