# MeshExploder and boundingBox collision

**URL:** <https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954>\
**Category:** Bugs\
**Tags:** meshes, position\
**Created:** [November 23, 2022, 2:15pm UTC](https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954 "2022-11-23T14:15:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebaw65](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebaw65/32/28297_2.png) [@sebaw65](https://forum.babylonjs.com/u/sebaw65)\
**Post date:** [November 23, 2022, 2:15pm UTC](https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954/1 "2022-11-23T14:15:17Z")

</div>

Hi!

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:

- first without updating boundingBox: [https://playground.babylonjs.com/#KYXTFG#3](https://playground.babylonjs.com/#KYXTFG#3)
- and secound with updating boundingBox: [https://playground.babylonjs.com/#KYXTFG#2](https://playground.babylonjs.com/#KYXTFG#2)

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:

 ![obraz](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/7/a7552980bdf218c265d5675c757a1ede23d3a972.png)

Max position:

 ![obraz](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/5/f53927b407db65686d3e4322b781c35427a787bb.png)

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

 ![obraz](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/5/1/518879f3a036dc9d1c43dde9b2f0d238efbd473e.png)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [November 23, 2022, 8:43pm UTC](https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954/2 "2022-11-23T20:43:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [November 23, 2022, 10:06pm UTC](https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954/3 "2022-11-23T22:06:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [November 24, 2022, 12:20pm UTC](https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954/4 "2022-11-24T12:20:59Z")

</div>

You invented chaos 🙂

Here’s a smaller repro:

> **[Babylon.js Playground](https://playground.babylonjs.com/#KYXTFG%237)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

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:

> **[Babylon.js Playground](https://playground.babylonjs.com/#KYXTFG%238)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

**Author:** ![sebaw65](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebaw65/32/28297_2.png) [@sebaw65](https://forum.babylonjs.com/u/sebaw65)\
**Post date:** [November 24, 2022, 12:57pm UTC](https://forum.babylonjs.com/t/meshexploder-and-boundingbox-collision/35954/5 "2022-11-24T12:57:04Z")

</div>

Thanks a lot! It’s works now!
