-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeviceOrientationEvent.requestPermission() #168
Comments
Thanks for the feedback. iOS in general doesn't support WebXR. |
In deed, it works with polyfill on iOS. |
OMG THANK YOU SO MUCH |
Hi @psusset , it works for VR button in web site page but not in scene button. How do you use it for in scene button? |
HI @jamwitk , I use an HTML button in the page and not a button on the unity side. I think it's not possible to use a button inside of Unity because the deviceorientationrequest must be handled by the webpage. |
Thank you for your feedback, I have tried write into .jslib and call on start but it gives error such that it need user gesture something like this. It seems as you say it is not possible.
|
I think that in Unity 2022.1 beta they added gyro support for WebGL. |
Also, if you have relevant device, you should be active in the WebXR Polyfill issue I mentioned and the other relevant issues mentioned there. |
Hello,
In order to make this plugin work on iOS, you need to ask user permission for device orientation capture.
To do that, we need to insert the following code in the requestSession action.
navigator.xr.requestSession('immersive-vr', {
requiredFeatures: thisXRMananger.gameModule.WebXR.Settings.VRRequiredReferenceSpace,
optionalFeatures: thisXRMananger.gameModule.WebXR.Settings.VROptionalFeatures
}).then(async (session) => {
if (typeof(DeviceOrientationEvent) !== "undefined" && typeof(DeviceOrientationEvent).requestPermission === 'function')
{
DeviceOrientationEvent.requestPermission()
.then(response => {
if (response === 'granted') {
session.isImmersive = true;
session.isInSession = true;
session.isAR = false;
thisXRMananger.xrSession = session;
thisXRMananger.onSessionStarted(session);
}
}).catch(function (error) {
thisXRMananger.BrowserObject.resumeAsyncCallbacks();
thisXRMananger.BrowserObject.mainLoop.resume();
});
} else {
session.isImmersive = true;
session.isInSession = true;
session.isAR = false;
thisXRMananger.xrSession = session;
thisXRMananger.onSessionStarted(session);
}
});
The text was updated successfully, but these errors were encountered: