Hi @sebavan, let me explain using a specific case how I sometimes catch this error. In the game, the character moves through space; a FreeCamera is attached to it, and a Spatial Sound listener is attached to that camera. As long as the coordinate precision stays at a reasonably whole-number level, everything is fine. As soon as the fractional part becomes extremely precise, an error occurs because of a very large fractional component.
The position is updated continuously, and the issue is quite rare, but it can happen from time to time. As I’ve studied in detail, this is not specific to Firefox only - the difference is that Firefox completely freezes when this error occurs, while Chrome allows the error to happen. However, recently Chrome has also started freezing on this error.
The solution as I see it: either we add a service layer between assigning coordinates to the Spatial Sound listener, or we add a filter directly to the Sound object.
But of course, considering that this breaks attachToMesh, there’s no way for me to plug in my own custom service here. I’d like this to work at the level of BabylonJS itself, without my own hacks or workarounds.
BTW: It related bug, but isn’t audio problem at all. Time to time when I read Position from character mesh, I got Y position is NaN and can’t set this position to the Camera.
Cool, ya, that will kill the error message, but it will not set the parameter’s value. The PR I made for this (https://github.com/BabylonJS/Babylon.js/pull/17579) does something similar but falls back to setting the parameter’s value directly instead. Try out the latest version of Babylon.js and you should not see the setValueCurveAtTime errors anymore.
Thank you so much. I’m really looking forward to the fix being included in the next BabylonJS release. I tried 8.44.1, and it doesn’t seem to have this fix yet. Firefox shows:
Anyway we have huge progress. In the Chrome this error disappears completely.
Now we see another error (in same place spatialAudio, but another). Firefox, oh, Firefox.
Oh interesting. This is a slightly different error occurring when setting the value directly. I had not expected this would also fail when curves are active, but it does on Firefox (of course).
I will try again to repro this on Firefox since it’s doing strange things. If I can get it to repro then I have a dev build of Firefox I’ll debug it on to come up with a better solution.
There is some issue with Firefox’s implementation of cancelScheduledValues causing this. It works 99.999% of the time, but fails in some rare cases when there are a lot of calls to cancelScheduledValues and setValueCurveAtTime with overlapping time ranges. Since this happens so rarely I’m going to remove the fallback that’s also throwing an error on Firefox in this case and only log a warning.