stalgiag / p5.xr

a library that helps turn p5.js sketches into immersive experiences using WebXR
GNU Lesser General Public License v2.1
117 stars 25 forks source link

createARCanvas() does not work with preload #73

Open stalgiag opened 4 years ago

stalgiag commented 4 years ago

Getting

Uncaught TypeError: Cannot read property 'set' of undefined
    at p5xrViewer.set (p5xr.js:8123)

works fine in setup() but canvas is visible before launching and sketch is running in background before AR is entered.

msub2 commented 3 years ago

Did a bit of digging on this. As far as I can tell, p5.instance._renderer is correct (RendererGL) all the way until it requests the reference space in p5ar.js. Inside the .then(), the renderer comes back as a Renderer2D. All I can think of is that there's some weird race condition happening here that doesn't happen with setup(). but I have no idea what it could be right now. Very spooky.

stalgiag commented 3 years ago

Thanks for digging. The way that we are handling preload methods might need to change for the createARCanvas. Luckily I would say this isn't the highest priority yet since it might require significant investigation time.

tomermesser commented 2 years ago

please implement the possibility of loading 3d models in AR canvas.

stalgiag commented 2 years ago

I was under the impression that model loading worked with loadModel() in preload with AR but I don't have a WebXR compatible phone atm. I can look into it when I get access to a phone.