mirror of
https://github.com/PrismarineJS/prismarine-web-client.git
synced 2024-11-27 18:15:46 -05:00
Fix vr button for android
This commit is contained in:
parent
843b9a5f43
commit
46d7c53012
2 changed files with 2 additions and 10 deletions
6
index.js
6
index.js
|
@ -334,12 +334,6 @@ async function connect (options) {
|
||||||
}
|
}
|
||||||
lastTouch = e.touches[0]
|
lastTouch = e.touches[0]
|
||||||
}, { passive: false })
|
}, { 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.requestPointerLock = renderer.domElement.requestPointerLock ||
|
||||||
renderer.domElement.mozRequestPointerLock ||
|
renderer.domElement.mozRequestPointerLock ||
|
||||||
|
|
|
@ -5,11 +5,9 @@ const { GLTFLoader } = require('three/examples/jsm/loaders/GLTFLoader.js')
|
||||||
const { XRControllerModelFactory } = require('three/examples/jsm/webxr/XRControllerModelFactory.js')
|
const { XRControllerModelFactory } = require('three/examples/jsm/webxr/XRControllerModelFactory.js')
|
||||||
const TWEEN = require('@tweenjs/tween.js')
|
const TWEEN = require('@tweenjs/tween.js')
|
||||||
|
|
||||||
async function initVR (bot, renderer, viewer) {
|
function initVR (bot, renderer, viewer) {
|
||||||
if (!('xr' in navigator)) return
|
if (!('xr' in navigator)) return
|
||||||
|
if (!navigator.userAgent.includes('OculusBrowser')) return
|
||||||
const supported = await navigator.xr.isSessionSupported('immersive-vr')
|
|
||||||
if (!supported) return
|
|
||||||
|
|
||||||
// VR
|
// VR
|
||||||
document.body.appendChild(VRButton.createButton(renderer))
|
document.body.appendChild(VRButton.createButton(renderer))
|
||||||
|
|
Loading…
Reference in a new issue