# Mesh physics imposter doesnt work

**URL:** <https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517>\
**Category:** Questions\
**Created:** [April 12, 2019, 12:57am UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517 "2019-04-12T00:57:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Immortality](https://avatars.discourse-cdn.com/v4/letter/i/bc8723/32.png) [@Immortality](https://forum.babylonjs.com/u/Immortality)\
**Post date:** [April 12, 2019, 12:57am UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/1 "2019-04-12T00:57:29Z")

</div>

I’m making minecraft with babylon.js. I made object, then set mesh physics imposter.I also set player’s physics imposter as sphere imposter. However, they dont collide and player just goes through map.

map is made manually, like the code below.

```auto
newVertices.push(x,y-1,z);
    newVertices.push(x,y,z);
    newVertices.push(x+1,y,z);
    newVertices.push(x+1,y-1,z);
    Cube(b);//add vertices then create face etc.

```

I set to update physics imposter every time map model is updated(when block is placed or removed)

```auto
mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.MeshImpostor, {restitution:0}, scene);

```

How can I make these collide? Please help me. thanks.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 12, 2019, 2:04pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/2 "2019-04-12T14:04:19Z")

</div>

Pinging @trevordev

To get faster help you may want to share a repro in the playground 🙂

---

<div class="post-metadata">

**Author:** ![Immortality](https://avatars.discourse-cdn.com/v4/letter/i/bc8723/32.png) [@Immortality](https://forum.babylonjs.com/u/Immortality)\
**Post date:** [April 12, 2019, 3:03pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/3 "2019-04-12T15:03:57Z")

</div>

Sorry but it’s private project. I cannot open-source it.

---

<div class="post-metadata">

**Author:** ![JohnK](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/johnk/32/26764_2.png) [@JohnK](https://forum.babylonjs.com/u/JohnK)\
**Post date:** [April 12, 2019, 3:34pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/4 "2019-04-12T15:34:19Z")

</div>

No need to do whole project. Using a simplified map and player recreate the problem. In other words can you show that in a playground that mesh physics imposter is not working in a simplified situation?

---

<div class="post-metadata">

**Author:** ![PirateJC](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/piratejc/32/1003_2.png) [@PirateJC](https://forum.babylonjs.com/u/PirateJC)\
**Post date:** [April 12, 2019, 5:11pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/5 "2019-04-12T17:11:53Z")

</div>

Hi @Immortality,

First SWEET!!! So cool that you’re making Minecraft with Babylon! Can’t wait to see your progress on that.

I’m not sure if this helps, but I put together a playground with a cube and sphere to show off the basics of how physics works.

This should show the absolute basics of how to use physics imposters with your scenario of having a cube and sphere.

[https://playground.babylonjs.com/#1EJIW4](https://playground.babylonjs.com/#1EJIW4)

---

<div class="post-metadata">

**Author:** ![Immortality](https://avatars.discourse-cdn.com/v4/letter/i/bc8723/32.png) [@Immortality](https://forum.babylonjs.com/u/Immortality)\
**Post date:** [April 12, 2019, 5:18pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/6 "2019-04-12T17:18:06Z")

</div>

I’m sorry but it is very hard to compress all important features of my project.  
One thing I need to tell you is that PlaneImposter works.(but not what I wanted.).

---

<div class="post-metadata">

**Author:** ![trevordev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trevordev/32/16_2.png) [@trevordev](https://forum.babylonjs.com/u/trevordev)\
**Post date:** [April 12, 2019, 5:23pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/7 "2019-04-12T17:23:25Z")

</div>

@Immortality Can you share what babylon methods you are using to create the map. If you can have a playground that constructs a triangle the same way, that would be helpful.

---

<div class="post-metadata">

**Author:** ![Immortality](https://avatars.discourse-cdn.com/v4/letter/i/bc8723/32.png) [@Immortality](https://forum.babylonjs.com/u/Immortality)\
**Post date:** [April 12, 2019, 5:26pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/8 "2019-04-12T17:26:50Z")

</div>

maybe this is the most simple, direct function what I am doing. other functions have too many strange feature.

function UpdateMesh(){  
var normals = [];  
BABYLON.VertexData.ComputeNormals(newVertices,newTriangles, normals);  
var vertexData = new BABYLON.VertexData();  
vertexData.positions = newVertices;  
vertexData.indices = newTriangles;  
vertexData.normals = normals;  
vertexData.uvs = newUV;  
vertexData.applyToMesh(mesh);  
mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.PlaneImpostor, {restitution:0}, scene);  
squareCount=0;  
newVertices=[];  
newTriangles=[];  
newUV=[];  
}

---

<div class="post-metadata">

**Author:** ![trevordev](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/trevordev/32/16_2.png) [@trevordev](https://forum.babylonjs.com/u/trevordev)\
**Post date:** [April 12, 2019, 6:01pm UTC](https://forum.babylonjs.com/t/mesh-physics-imposter-doesnt-work/2517/9 "2019-04-12T18:01:18Z")

</div>

It looks to work here: [Babylon.js Playground](https://playground.babylonjs.com/#ZHI6B7) is your scenario different?
