Fix vr button for android

This commit is contained in:
Karang 2021-03-22 01:24:08 +01:00
parent 843b9a5f43
commit 46d7c53012
2 changed files with 2 additions and 10 deletions

View file

@ -334,12 +334,6 @@ async function connect (options) {
}
lastTouch = e.touches[0]
}, { passive: false })
document.addEventListener('touchend', (e) => {
window.scrollTo(0, 0)
e.preventDefault()
e.stopPropagation()
lastTouch = undefined
}, { passive: false })
renderer.domElement.requestPointerLock = renderer.domElement.requestPointerLock ||
renderer.domElement.mozRequestPointerLock ||

View file

@ -5,11 +5,9 @@ const { GLTFLoader } = require('three/examples/jsm/loaders/GLTFLoader.js')
const { XRControllerModelFactory } = require('three/examples/jsm/webxr/XRControllerModelFactory.js')
const TWEEN = require('@tweenjs/tween.js')
async function initVR (bot, renderer, viewer) {
function initVR (bot, renderer, viewer) {
if (!('xr' in navigator)) return
const supported = await navigator.xr.isSessionSupported('immersive-vr')
if (!supported) return
if (!navigator.userAgent.includes('OculusBrowser')) return
// VR
document.body.appendChild(VRButton.createButton(renderer))