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
23.28k stars 3.44k forks source link

onPointerObservable functionality differs between latest and stable #6612

Closed sebastianwahn closed 5 years ago

sebastianwahn commented 5 years ago

Bug

Using:

scene.onPointerObservable.add((pointerInfo) => {
    ...        
});

differs between stable and latest babylon, when using a mobile device in VR mode. tested in iOS 12.1 & 12.3 in safari

Switch between latest & stable on a iOS safari. Maybe also a problem on other mobile devices.

sebavan commented 5 years ago

@sebastianwahn Did you enable orientation in Safari for IOS ???

By default now Safari does not authorize it anymore: https://doc.babylonjs.com/how_to/webvr_helper#detect-if-fallback-orientation-camera-is-supported

sebastianwahn commented 5 years ago

@sebavan yes, I tested this on my iPhone with 12.3.x installed and orientation toggled on. With the 4.0.3 (stable) version the movement of the camera in VR mode is tracked properly.

deltakosh commented 5 years ago

Ok so it is expected. We turn on the gaze on the VRExperienceHelper when there is no controller and no pointer (that we detect with pointerLock...which unfortunately is not supported on iOS).

You can turn off gaze by not calling vrHelper.enableInteractions().

Is it an option? Other option would be to add a boolean for you that will let the system ignore the pointerLock restriction

sebastianwahn commented 5 years ago

@deltakosh why is this behavior expected? With the same device and iOS the feature does work in 4.0.3 and does not work in 4.1.0 Or did you refactor the onPointerObservable in a way that the gaze tracking is not a pointer event anymore? If yes, is there an alternativ observable I can listen to, to receive a pointerInfo object when I'm in VR mode with a mobile device?

deltakosh commented 5 years ago

With the same device and iOS the feature does work in 4.0.3 and does not work in 4.1.0:

Because we added the test for pointerLock for 4.1

I went ahead and added a new property for you that you can turn on now: vrHrlper.enableGazeEvenWhenNoPointerLock = true

sebastianwahn commented 5 years ago

@deltakosh is this already included in the alpha build for me to test?

deltakosh commented 5 years ago

It is on nightly (on the repo) and I will push a npm update today :)

sebastianwahn commented 5 years ago

thanks!