# Havok - setEnabled() on Body / Shape?

**URL:** <https://forum.babylonjs.com/t/havok-setenabled-on-body-shape/40818>\
**Category:** Questions\
**Tags:** havok\
**Created:** [May 15, 2023, 2:49pm UTC](https://forum.babylonjs.com/t/havok-setenabled-on-body-shape/40818 "2023-05-15T14:49:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [May 15, 2023, 2:49pm UTC](https://forum.babylonjs.com/t/havok-setenabled-on-body-shape/40818/1 "2023-05-15T14:49:03Z")

</div>

Hi team,  
Is there any method to temporarily disable a physics body/shape ?

I have some meshes imported at scene creation, they’re then prepared for cloning/instancing/thinInstancing, some light shaders are precompiled, physics bodies setup, etc, then they’re disabled `mesh.setEnabled(false)`,  
but the bodies are still there and enabled/active meshes can collide with them.

---

<div class="post-metadata">

**Author:** ![Raggar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raggar/32/20672_2.png) [@Raggar](https://forum.babylonjs.com/u/Raggar)\
**Post date:** [May 15, 2023, 3:02pm UTC](https://forum.babylonjs.com/t/havok-setenabled-on-body-shape/40818/2 "2023-05-15T15:02:31Z")

</div>

You can call plugin.\_hknp.HP\_World\_RemoveBody(world, bodyID)

This removes the body from the physics world, but as long as you don’t call plugin.\_hknp.HP\_Body\_Release(bodyID), it is still allocated in the plugin and preserves information like transform and shape

To then add it again you simply call plugin.\_hknp.HP\_World\_AddBody(world, bodyID, startAsleep)

---

<div class="post-metadata">

**Author:** ![aWeirdo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/aweirdo/32/52_2.png) [@aWeirdo](https://forum.babylonjs.com/u/aWeirdo)\
**Post date:** [May 15, 2023, 3:26pm UTC](https://forum.babylonjs.com/t/havok-setenabled-on-body-shape/40818/3 "2023-05-15T15:26:03Z")

</div>

Seems good so far 🙂  
made a little prototype to help out

```
BABYLON.HavokPlugin.prototype.setPhysicsBodyEnabled = function(body, setEnabled = true){
    if(!body || !body._pluginData) return;

    if(setEnabled){
        this._hknp.HP_World_AddBody(this.world, body._pluginData.hpBodyId, body.startAsleep);
    }
    else {
        this._hknp.HP_World_RemoveBody(this.world, body._pluginData.hpBodyId);
    }
};

```
