DeviceOrientation in iOS 12.2

I just read this: Apple’s new Safari privacy settings threaten web-based VR and AR - The Verge

I know, the details on how Apple implements this are not really clear yet, but does anyone know if Babylon will handle requesting the permissions for the deviceOrientation or is that something we will have to do?

This will definitely be for @trevordev our XR/VR champion

1 Like

It will likely depend on how this is handled in safari. If safari displays a prompt on first use of the api, hopefully everything should just work with no changes on babylon or app code. If deviceOrientation is needed and babylon sees the webpage does not yet have permission I think babylon should handle the prompt if possible. In this case existing apps will likely be broken until they update to the latest version of babylon or add the prompt themselves.

VR and device motion sensors are still not working in babylonjs for iPhones. Seems like Babylonjs have to implement the new api. More information can be found at this link:

Maybe @RaananW, who has been working on WebXR implementation in Babylon.js, can help.


you gotta love apple. And “new APIs” for no apparent reason.
Can you create a ticket for this on github? we will see when we can attack this and add the code to iOS devices. We usually dont like those kind of “single browser functions”, but sometimes we have to keep up with craziness of other browsers.

Having said that, as @thomlucc said, we are constantly working on making webxr work. I am not sure Safari and iOS are in any way attempting to have that implemented, but I just saw that firefox is working on porting webxr to ios for quite some time, maybe there is hope. When the draft is complete, I hope that even apple will have that implemented and we will all work with a single standard. because web standards always work the same in all brow… oh, forget it :wink:

1 Like

I created an issue for this on GitHub and linked this forum and the article i just posted there.

1 Like

Just wanted to follow up on this - it was integrated in the system, but there is a small issue that needs to be addressed (this - Uncaught ReferenceError for BABYLON.Scene.CreateDefaultVRExperience on non-VR machine) .


Hi ,

I am create my own Camera to try to register devicemotion, the register method is ok , but listener method not receive event.

public attachControlDevice(element: HTMLElement, noPreventDefault?: boolean): void {
// clear all Camera Inputs
let hostWindow = this.getScene().getEngine().getHostWindow();

    if(window.DeviceOrientationEvent && Util.isIOS){ //Check if device is compatible
        hostWindow.addEventListener("deviceorientation", this._deviceOrientation);
    } else {
        alert("Sorry, try again on a compatible mobile device!");


Any advice is welcome


@RaananW will for sure be able to help you but it would be nice to have more info an a repro if possible ?

Hi @falex,

you will need to follow the iOS guidlines to request this event. See the guide posted by CLB_ZReality:

Thanks @RaananW