Closed vincentfretin closed 6 years ago
I found the issue by trying to port ar planes visualization from https://github.com/chenzlabs/aframe-ar to aframe-xr. The tick function in ar-planes was called only once. With this PR, the tick function is called on each frame like it supposed to.
removing that will break other things: we created an XRManager in anticipation of AFrame moving from VREffect to VRManager, and the XRManager is doing the rendering internally.
Now that WebXR is getting closer, and three.js is being updated to use WebXR instead of WebVR, AFrame will hopefully move to that, and both aframe-xr and aframe-ar can go away.
BUT, in the meantime, can you try adding this code (the code from scene.render
that you note is not being run) to updateFrame down at the bottom of the xr.js system file, and see if this works? I don't have time to test it right now, but I think this should work.
this.sceneEl.delta = this.sceneEl.clock.getDelta() * 1000;
this.sceneEl.time = this.sceneEl.clock.elapsedTime * 1000;
if (this.sceneEl.isPlaying) { this.sceneEl.tick(this.sceneEl.time, this.sceneEl.delta); }
Thanks for the explanation @blairmacintyre I'm starting to understand how all those libraries works together. :) Your proposed code indeed works like a charm.
Cool, glad to hear.
I'm looking forward to WebXR being finalized and three.js and aframe supporting directly. Then we won't need to do things like this! :smile:
I just noticed this is against master: can you re-send the PR against develop? It looks good, I'll pull it in. I'd like to test it against apainter-xr and store-xr (the two "more substantial" demos we have out there) before moving to master and doing a release.
Sure, I'll do it in the next minutes.
done
I just added a last commit to fix the raycaster click issue.
About your comment https://github.com/mozilla/aframe-xr/pull/18#issuecomment-388192632, aframe 0.8.2 doesn't use VREffect anymore. It is using THREE WebVRManager through THREE WebGLRenderer now. And I see basic WebXR support has been added 11 days ago to three.js https://github.com/mrdoob/three.js/pull/13978
Yes, I know they are finally moving to WebVRManager and that three is adding support for WebXR. Given that the immersive-web community hasn't even decided on a first version of the API, it is surprising to see this happening in three.js already, but I'm sure they'll keep up with the updates; there might be some fragility as things shift, tho.
When WebXR is more stable, I hope to shift the WebXR Viewer to just expose a version of it; once that happens, and aframe/three fully support webxr, the webxr-polyfill, three.xr.js and this package will need substantial changes.
If we can support the newer versions of aframe and three without breaking existing things that use aframe-xr, great. But I can't make changes that break anything right now.
BTW, this PR is still against "master".
Ah, the branch was rebased on develop and push forced, but I had to edit the PR to change the base branch. Should be good now.
We need to render the scene even on AR mode, otherwise components tick function is not executed.