meshImpostor, gltf model passes through other

Hello, everyone. Can you teach me that mesh collision?
I put meshImpostor when loading the model. However, the model always slips past the other model without responding to the collision. Your help would be very appreciated. Thank you.

My code↓

scene.enablePhysics(new BABYLON.Vector3(0,-10,0), new BABYLON.AmmoJSPlugin());
BABYLON.SceneLoader.ImportMesh("", "", "model.gltf", scene, function (newMeshes, particleSystems, skeletons) {
                   newMeshes[0].physicsImpostor = new BABYLON.PhysicsImpostor(newMeshes[0], BABYLON.PhysicsImpostor.MeshImpostor, {mass: 0, restitution: 0.8});

newMeshes[0] is probably not the right mesh. When loading a gltf/glb file, the first “mesh” is in fact a transform node that handles converting from right handed to left handed system. So, try newMeshes[1] instead. If it still does not work, you should provide a repro in the Playground so that people can help.


Yeah, I’m gonna have to agree with @Evgeni_Popov. Another option that you could also look into is adding a mesh to act as a sort of bounding box or collision mesh. Here’s an example: Babylon.js Playground (

1 Like

I tested meshImpostor but object passes through other…
…I want objects to move away when they collide :sob:


I think I should use intersectsMesh. You can see that when the ball hits the box, it bounces back.

Object bounces back when it hits another object. But it is not working well…


Adding @Cedric who is a killer with physics!

1 Like

Create an impostor for each mesh, add a static ground…and you are done:
pass through | Babylon.js Playground (


Thank you so much. :astonished:
Sorry, but it’s not working in gltf file… Could you teach me? @Cedric

This is improved version imported one by one. But object passes…

1 Like

You added the drag behavior to just the mesh which doesn’t move the imposters. I changed it to physicsRoot and now it works.


Thanks, Jedi master!!!

1 Like

Sometime pointerDragBehavior is not working, but I make this with your advice.
You can see my code in this link.

When the thing I am moving collides with something else, I want it to stop moving without fusing with the other thing. The meshimpostor is a slow process and the bumped object will move, so I decided to use an intersectsMesh to detect collision and stop the movement. I also understood that newmesh[1] can detect an intersectmesh instead of newmesh[0].
I would like to use other advice in the future, such as meshImpostor.

Thank you for all kindness.

test in, but it’s not working well.

@Cedric might help with the physix part

1 Like

I appreciate all of your advice. But, physix is too difficult for me…

You can check my program in this link. It’s not working well…

My gltf file is here…

Would be great if you could setup the repro in the playground :slight_smile:

1 Like

intersectsMesh version_working, but kitchen react when you touch to the vacant space of others.

physicsImpostor version_not working well

My goal is to do things which hit that don’t move and things that don’t overlap.

A mesh impostor can only be static (with mass == 0). If you want to move a more complex object, you should use compound objects :

1 Like