是否存在在某个地方使用应用拥有的运行循环(使用ownRunLoop = false)的示例?
当我基于three.js应用创建一个简单的示例时:
const onxrloaded = () => {
const canvas = document.getElementById('camerafeed')
// Open the camera and start running the camera run loop.
XR.run({canvas, ownRunLoop:false})
function render() {
XR.runPreRender(Date.now());
XR.runPostRender(Date.now());
}
function animate() {
requestAnimationFrame( animate );
render();
}
animate();
}
window.onload = () => {window.XR ? onxrloaded() : window.addEventListener('xrloaded', onxrloaded)}
我收到以下错误:
xrweb.js:3 Uncaught TypeError: Cannot read property '_c8EmAsm_flushTrace' of undefined
at Object.V [as runPreRender] (VM737 xrweb.js:3)
at render (index.js:121)
at animate (index.js:126)
at onxrloaded (index.js:128)
at window.onload (index.js:131)
对这个问题有什么想法吗?
答案 0 :(得分:2)
您可能需要确保在调用runPre / PostRender之前已调用onStart。