MeshExploder and boundingBox collision


For some time now I have a problem with using MeshExploder and boundingBox recalculation at the same time.
Probably it’s a bug. I have prepared two playgrounds:

The problem is visible when we move the slider to the maximum value (with the mouse) and then start slowly moving it in the other direction. However, slider value should not go to zero. - it’s working only on secound playground

Zero position:

Max position:

Slowly decrease slider value, and exploded meshes are disappeared in space

I am unfortunately not able to repro following your instructions :frowning: @Evgeni_Popov can you repro ?

I can reproduce with the 2nd PG. If you move slowly the slider from around 1.8 to 2 (max), it will break.

It does not happen if parent.setBoundingInfo(new BABYLON.BoundingInfo(boundingBoxMaxMin.min, boundingBoxMaxMin.max)); (line 98) is commented.

I didn’t find the reason by looking quickly, I will look tomorrow if the problem persists.

1 Like

You invented chaos :slight_smile:

Here’s a smaller repro:

Look at the console: after a while, the Y-value diverges and skyrockets. This is because the computation does not have infinite precision, so after an explosion the center of the bounding box is not exactly the same as at the start ((3,6,0)) and because this position is reused inside the explosion, it adds up every time we call explode and ends with a computational explosion (real this time!)!

The easiest way to fix this is to use a separate mesh for the center of the explosion:


Thanks a lot! It’s works now!