I’m trying to do a calculation that takes more than one frame. I’ve put this in a promise, but I still get major stutter. How do I have to structure that kind of thing for it to not affect the framerate?
The thing I’m trying to do is watch for QR codes from the camerastream, so the structure is basically:
const callMyLoop(){
new promise((resolve, reject) => {
const result = doAThingThatTakesMoreThanOneFrame()
if(result){
resolve()
} else{
reject()
}
})
}
Thanks for that specific feedback, I’ve found a different version of that function that seems asynchronous since it returns a promise. I’ve added my other code to the then of that promise. Unfortunately it keeps stuttering… So I suspect it has a similar implementation as to what I was doing before.
I suppose there’s not really a way to do threading with BabylonJS?
Hi! Thanks, I’m currently looking at workers. I’ve used coroutines with unity in the past, but the problem here is that I just have one function call that I can’t really break up.
I’m diving into Workers now though, hope that fixes it Thanks again for all the suggestions.