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

millis() and deltaTime not working in VR #133

Closed anagondesign closed 3 years ago

anagondesign commented 3 years ago

Hi! I'm working on making examples for the VR section of the p5.xr library and encountered an issue when trying to use different timing functions in VR.

I made a sketch using an array of letters that changes at certain time intervals. When I use millis() or deltaTime in regular WEBGL mode, the sketch runs properly and the letters change like how they're intended to. However, when I transfer the sketch over to VR, the letters don't change at all and I don't know why. The only way to get the animation running in the browser is if I replace "deltaTime" with "frameCount." While this works for now, it still ends up changing the letters faster than intended and I'd much prefer to use deltaTime over this method.

Here's a link to the p5.js sketch: https://editor.p5js.org/anagondesign/sketches/qmwVk2EGY

If anyone knows a way to resolve this issue and get deltaTime to function, I'd really appreciate any help on this! Thank you!