AfterWorldMatrixUpdate Observable issue with Babylon 5

Babylon 5.5.5 has a new issue where onAfterWorldMatrixUpdateObservable combined with computeWorldMatrix() causes Maximum callstack;
I found this previous post by @Evgeni_Popov which mentions that the maximum callstack is not supposed to happen.

The playground he uses is this one below (unchanged), and you’ll find that it does have infinite recursion with B5:

In my current application, when the player teleports we move a worldOffset transformNode with him/her so we can avoid z-fighting. To avoid sounds to follow the player we update the sound’s position to account for the worldOffset.

this means we end up with a code pattern very similar to that playground.

Is this an actual bug? Any tricks?

@carolhmj do you want to have a look ?

Will do!

Fix is here :rofl: Fix a stupid bug by deltakosh · Pull Request #12504 · BabylonJS/Babylon.js (github.com)

3 Likes

That was fast :sweat_smile:, thanks!; Any ideas when next release is?

You are the best @carolhmj :slight_smile:

1 Like

Should be live in a hour or 2:)

3 Likes

1 Like

We found this fix made our assets randomly nudged to the side after using mesh.translate() on local axes :sweat_smile:

We’ll have a look at what’s causing it on our side, but a broad description of what the fix actually solves would help us look for where we got it wrong!

You can see here on the file changes Fix a stupid bug by deltakosh · Pull Request #12504 · BabylonJS/Babylon.js (github.com), we previously had added an optimization to skip computing the world matrix if the renderId didn’t change, but the condition was flipped (a !== rather than a ===)

The initial change was added on 5.5.5, can you check 5.5.4 to see if your assets work there?