# Ammo.js meshimposter collision offset?

**URL:** <https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747>\
**Category:** Questions\
**Tags:** ammojs\
**Created:** [September 7, 2022, 11:31am UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747 "2022-09-07T11:31:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [September 7, 2022, 11:31am UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/1 "2022-09-07T11:31:35Z")

</div>

We experiencing an offset when creating a mesh imposter for the physics, ammo.js.  
The 3d models we use have around 1000 polygons each and are not too complicated, mostly convex.

It seems that the collsion shape of the mesh seems to be correct but it has an offset along the normals, like it is inflated around 50% or so.  
The image is just showing the meshes, NOT the offset, just you have an idea of the geometry.

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/9/c9ff0558f376bbbb26dfc1f0048415c69fa5747a.jpeg)

Is there a ‘feature’ how ammo.js handles the collision on the mesh impostores with a precision or an offest or similar parameters?

Unfortunately we dont do playground dev. right now so I cant post a link.

Another thing might be that the meshes we created have some flaws, which would be weird but might be.  
As a test I tried simplified versions of these meshes, but I might create completely new ones as well to try…

Thx.  
Werner

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [September 7, 2022, 11:43am UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/2 "2022-09-07T11:43:20Z")

</div>

pinging @Cedric

---

<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, 2022, 11:54am UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/3 "2022-09-07T11:54:47Z")

</div>

I’ve never experienced such issue.  
It will be difficult to debug without a PG repro.  
Are you using mesh impostor or convex hull?

---

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [September 7, 2022, 11:55am UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/4 "2022-09-07T11:55:53Z")

</div>

mesh imposter.  
This is the distance between the meshes.

Or is it, that collision between meshes is not working correctly?

```auto
this.mesh.position = initialPos;
        this.mesh.physicsImpostor = new PhysicsImpostor(this.mesh, PhysicsImpostor.MeshImpostor, 
            {
                mass : Coral.fixedMass,
                friction : 0,
                damping : 0.1,          
            }, scene);

```

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/e/9e68f44de2544a5dc8280aa0e7e6a1a3ca83c9b4.png)

Here are 2 simple spheres …

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/6/b634d8e004c0e6b881fb793ed17d56d9d361fe62.png)  
There is an offset as well…

Is there a rule, in terms of units for the physic?

---

<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, 2022, 12:18pm UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/5 "2022-09-07T12:18:16Z")

</div>

is `Coral.fixedMass` value 0 ? ammojs mesh impostor must be static.

---

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [September 7, 2022, 12:46pm UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/6 "2022-09-07T12:46:37Z")

</div>

ups. That I missed… Is that documented?

So for these kind of shapes I need to build some sompound objects using standard collision shapes then?

… similar to that?

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

---

<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, 2022, 1:00pm UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/7 "2022-09-07T13:00:06Z")

</div>

I can confirm a mesh impostor with a mass \> 0 will create a convex hull instead. That’s why you see some inflation.  
I guess the impostor you want to create are concave. So, in that case, yes, you have to create compounds.

---

<div class="post-metadata">

**Author:** ![yamaciller](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yamaciller/32/21810_2.png) [@yamaciller](https://forum.babylonjs.com/u/yamaciller)\
**Post date:** [September 7, 2022, 1:36pm UTC](https://forum.babylonjs.com/t/ammo-js-meshimposter-collision-offset/33747/8 "2022-09-07T13:36:28Z")

</div>

That all makes sense now!!  
Thank you so much!

We are going to build compounds now.

best.  
Werner
