mirror of
https://github.com/PrismarineJS/prismarine-web-client.git
synced 2025-02-17 07:40:14 -05:00
properly test if vr supported (#135)
This commit is contained in:
parent
119fb046a6
commit
ebf0fa0766
1 changed files with 5 additions and 1 deletions
|
@ -5,8 +5,12 @@ const { GLTFLoader } = require('three/examples/jsm/loaders/GLTFLoader.js')
|
|||
const { XRControllerModelFactory } = require('three/examples/jsm/webxr/XRControllerModelFactory.js')
|
||||
const TWEEN = require('@tweenjs/tween.js')
|
||||
|
||||
function initVR (bot, renderer, viewer) {
|
||||
async function initVR (bot, renderer, viewer) {
|
||||
if (!('xr' in navigator)) return
|
||||
|
||||
const supported = await navigator.xr.isSessionSupported( 'immersive-vr' )
|
||||
if (!supported) return
|
||||
|
||||
// VR
|
||||
document.body.appendChild(VRButton.createButton(renderer))
|
||||
renderer.xr.enabled = true
|
||||
|
|
Loading…
Reference in a new issue