# Havok PhysicsBody.shape identity

**URL:** <https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421>\
**Category:** Bugs\
**Created:** [September 24, 2023, 7:32pm UTC](https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421 "2023-09-24T19:32:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ComicSans](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/comicsans/32/19314_2.png) [@ComicSans](https://forum.babylonjs.com/u/ComicSans)\
**Post date:** [September 24, 2023, 7:32pm UTC](https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421/1 "2023-09-24T19:32:42Z")

</div>

In Havok, it appears that the `PhysicsShape` that you set on a `PhysicsBody` is not the same object if you read it back. That’s a bit confusing itself, but even more so is that `isTrigger` on the returned object is wrong. I wasted a good hour on that today, since I was making decisions on how to initialize objects based on whether they were a trigger or not.

Here’s an [illustrative PG](https://playground.babylonjs.com/#M0C2X5#53). The console output at this point in time is:

```auto
trigger shapes are not-equal
triggerBody.shape.isTrigger false

```

Is this working as intended? Cheers!

---

<div class="post-metadata">

**Author:** ![ComicSans](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/comicsans/32/19314_2.png) [@ComicSans](https://forum.babylonjs.com/u/ComicSans)\
**Post date:** [September 24, 2023, 9:14pm UTC](https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421/2 "2023-09-24T21:14:49Z")

</div>

Ok, I found another curious thing, that may be related (or maybe not).

I get collision callbacks between my character and a trigger. The TRIGGER\_ENTERED always fires, but the COLLISION\_STARTED sometimes **also** fires when I update the character’s position (with disabledPreStep off, of course). I [updated the playground](https://playground.babylonjs.com/#M0C2X5#55) to make this behavior apparent, too. Just click the mouse to update the sphere’s position randomly.

---

<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 25, 2023, 11:49am UTC](https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421/3 "2023-09-25T11:49:37Z")

</div>

Hello!

getShape indeed returns a new object every time it is called: [https://github.com/BabylonJS/Babylon.js/blob/1d039a781a1d7a0b2c361817ce1cfcea88174274/packages/dev/core/src/Physics/v2/Plugins/havokPlugin.ts#L666](https://github.com/BabylonJS/Babylon.js/blob/1d039a781a1d7a0b2c361817ce1cfcea88174274/packages/dev/core/src/Physics/v2/Plugins/havokPlugin.ts#L666), but they refer to the same underlying Havok object, so if you compare their `_pluginData[0]` property (it’s a array with one member), it is the same: [PhysicsShape identity 2 | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#M0C2X5#56)

About the collision event firing, I’m not sure about why this behavior is happening, let me tag @eoin to check 🙂

---

<div class="post-metadata">

**Author:** ![ComicSans](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/comicsans/32/19314_2.png) [@ComicSans](https://forum.babylonjs.com/u/ComicSans)\
**Post date:** [September 25, 2023, 7:01pm UTC](https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421/4 "2023-09-25T19:01:02Z")

</div>

Got it. So, since the newly instantiated getShape object doesn’t expose the correct value of `isTrigger`, should that getter property be removed? Otherwise it’s going to confuse a lot more people than just me. 😅

---

<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 26, 2023, 4:05pm UTC](https://forum.babylonjs.com/t/havok-physicsbody-shape-identity/44421/5 "2023-09-26T16:05:00Z")

</div>

The collision event thing is a bug, nice catch! Will get it fixed in the next plugin version.
