# Collision Impostors for Imported Meshes Imperfect

**URL:** <https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394>\
**Category:** Questions\
**Tags:** ammojs, mesh, physics, glb\
**Created:** [July 13, 2023, 5:32pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394 "2023-07-13T17:32:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfellows88](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rfellows88](https://forum.babylonjs.com/u/rfellows88)\
**Post date:** [July 13, 2023, 5:32pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394/1 "2023-07-13T17:32:45Z")

</div>

Hello, I’m rather new to Babylon so forgive me if I’ve gotten myself in over my head and just don’t realize it yet, but what I’m trying to do is to import a GLB that has no collision framework generated for it outside of Babylon and react physically realistically when dropped into the scene.

I’ve piggybacked off of someone else’s PG to create an example of the system that detects the collision, but then the impostor that is generated for the Palm (in this case) is imperfect and doesn’t react correctly. It also fails to be rendered by physicsViewer.

PG: [https://playground.babylonjs.com/#S7E00P#405](https://playground.babylonjs.com/#S7E00P#405)

I appreciate any suggestions anyone has, even if it’s “read up on _topic_ more.”

---

<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:** [July 13, 2023, 5:55pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394/2 "2023-07-13T17:55:03Z")

</div>

cc @carolhmj and @Cedric

---

<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:** [July 13, 2023, 7:51pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394/3 "2023-07-13T19:51:16Z")

</div>

Hello! I see the palm is composed of multiple meshes with a single parent, which the mesh impostor unfortunately isn’t able to correctly instantiate. You’d have to create a mesh impostor for each child, then create a compound for them: [Compound Bodies | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/legacy/physics/compoundBodies).

If you don’t need to use Ammo, our new Physics architecture with Havok is MUCH better at handling compounds, you just need to create a mesh shape with the `includeChildMeshes` option and pass the parent: [Imported Mesh Auto Collision | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#S7E00P#408)

On a separate note, I restructured your example a bit to use the `addContainerTask` instead of the `addMeshTask`, the nice thing about using [Asset Containers | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/features/featuresDeepDive/importers/assetContainers) is that you don’t need to worry about setting the meshes you don’t want as not visible, you only add what you want to the scene 🙂

---

<div class="post-metadata">

**Author:** ![rfellows88](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rfellows88](https://forum.babylonjs.com/u/rfellows88)\
**Post date:** [July 13, 2023, 8:23pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394/4 "2023-07-13T20:23:54Z")

</div>

@carolhmj,

Interesting! I had no idea the model was composed of multiple meshes. I never opened it in an editor, I just started trying to achieve my proof of concept with the assets in the existing playground.

Incidentally, how were you able to tell that was the case? Is there a property I should have been able to review to have known that or would I have had to open it in an editor to find that out?

Thanks for the quick and concise response. You’ve saved me a ton of time chasing my tail, I’m sure.

---

<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:** [July 13, 2023, 8:33pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394/5 "2023-07-13T20:33:25Z")

</div>

No external editor needed, we have the trusty Inspector for that: [The Inspector | Babylon.js Documentation (babylonjs.com)](https://doc.babylonjs.com/toolsAndResources/inspector) 😃 Very much recommend getting acquainted with the Inspector and its features, because they save a tooon of time when debugging! You can open the Inspector in any Playground by clicking this button here:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/2/a2ea0499fa708730d9844f6e4f8559d4ebbb32b6.png)

Doing that allows us to see how the tree is composed of multiple meshes:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/2/b26690a23a5326225d4bc6bdf57fe0c3ee11ec32.jpeg)

Another useful alternative to quickly check models is the [Babylon.js Sandbox - View glTF, glb, obj and babylon files (babylonjs.com)](https://sandbox.babylonjs.com/). The nice thing with it is that you don’t need to write any code - you can just drag and drop your model and see it how it looks. The Sandbox also has the Inspector, so you can also do quick adjustments there, like changing a material’s color, etc, to see how it looks.

Hope these tools are helpful in your Babylon journey! 🙂

---

<div class="post-metadata">

**Author:** ![rfellows88](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@rfellows88](https://forum.babylonjs.com/u/rfellows88)\
**Post date:** [July 13, 2023, 9:03pm UTC](https://forum.babylonjs.com/t/collision-impostors-for-imported-meshes-imperfect/42394/6 "2023-07-13T21:03:35Z")

</div>

D’oh! That seems super obvious now. I am generally working on a local server (using notepad, as I am a bit old-school) and never played with it in the playground or incorporated the inspector into my local setup. It sounds like I should be using this tool more.

Thanks for answering a question some might see as obvious or dumb with patience!
