# How can i enable and disable a physics aggregation

**URL:** <https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909>\
**Category:** Questions\
**Created:** [September 7, 2023, 4:45am UTC](https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909 "2023-09-07T04:45:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jisan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/jisan/32/34571_2.png) [@Jisan](https://forum.babylonjs.com/u/Jisan)\
**Post date:** [September 7, 2023, 4:45am UTC](https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909/1 "2023-09-07T04:45:36Z")

</div>

how can i enable and disable a physics aggregation.

If i disable a mesh with mesh.setEnabled(false); but physics aggregation still working .

---

<div class="post-metadata">

**Author:** ![Cedric](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/cedric/32/2742_2.png) [@Cedric](https://forum.babylonjs.com/u/Cedric)\
**Post date:** [September 7, 2023, 8:18am UTC](https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909/2 "2023-09-07T08:18:34Z")

</div>

You are the first one asking for that AFAIK.  
There is no way to do so for now. simplest solution is to delete/recreate body.  
Do you see another solution @carolhmj ?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 11, 2023, 11:03am UTC](https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909/3 "2023-09-11T11:03:08Z")

</div>

I checked the Havok package and there doesn’t seem to be a function to disable a body/shape, unless I missed something @eoin ?

---

<div class="post-metadata">

**Author:** ![eoin](https://avatars.discourse-cdn.com/v4/letter/e/f14d63/32.png) [@eoin](https://forum.babylonjs.com/u/eoin)\
**Post date:** [September 11, 2023, 12:05pm UTC](https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909/4 "2023-09-11T12:05:28Z")

</div>

Yeah, we can do that. HP\_World\_RemoveBody() will remove the body from the simulation, so it’ll stop being updated and will stop affecting other bodies. Then, HP\_World\_AddBody() will enable it again.

Probably just need a little refactoring in HavokPlugin. The latter is called automatically by HavokPlugin.initBody(), to allow it to be called “manually.” The former function is already exposed by HavokPlugin.removeBody(), but probably want to keep the observers intact…

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [September 11, 2023, 12:08pm UTC](https://forum.babylonjs.com/t/how-can-i-enable-and-disable-a-physics-aggregation/43909/5 "2023-09-11T12:08:01Z")

</div>

Assigned @carolhmj on September 11, 2023, 12:08pm UTC


