1
votes

Is there a way in AFrame / three.js to check that the user is really looking at the program on a VR device such as Oculus Quest rather than just using a web page on a PC? In particular is it possible to read back the device ID, such as the Quest ID from AFrame? My problem is that I really want to be sure that users are running the program from within a VR headset, and not just running it on a PC based browser.

thanks.

1

1 Answers

1
votes

My problem is that I really want to be sure that users are running the program from within a VR headset, and not just running it on a PC based browser.

Instead of sniffing for hardware details (reading out the Quest ID is not possible for good reasons), you can check if the user is in XR mode. This can be done by evaluating the isPresenting flag:

console.log( renderer.xr.isPresenting );