Imported mesh collision with Camera ellipsoid - Requirements?

I have problems with few different imported objects. My camera (ellipsoid) sometimes just goes through the object very slowly and my camera gets stuck in it. I tried both checkCollision and physic impostors, but nothing seems to work.

-Are there any specific requirements how object should be made, that collision works without any problem?
-Is there any way to set (calculate) collision box of objects?

***Playground - Lines 39-50:

   BABYLON.SceneLoader.ImportMeshAsync("", "", "", scene).then((result) => {
        var birds = result.meshes[0];
        birds.scaling = new BABYLON.Vector3(5, 5, 5);
        birds.position = new BABYLON.Vector3(-4, -10, 0);
        for (let i = 0; i < result.meshes.length; i++) {
            var meshAll = result.meshes[i]
            meshAll.checkCollisions = true;
            meshAll.physicsImpostor = new BABYLON.PhysicsImpostor(meshAll, BABYLON.PhysicsImpostor.MeshImpostor, { mass: 0, friction: 1 }, scene);


cc @Cedric

It is probably something about object specifications, because collisions work fine on some objects and on some not:

This one is pumpkin object:


It will look much better if you would add camera.minZ = 0.1

Example -

As for other problems - check mesh normals, when they are inverted you will pass through them.

1 Like

Here is one of simple examples with collision setup -

1 Like

Check also negative mesh scales and double sided meshes.
Avoid negative scales as much as possible!


Amazing project. I just had some problems with walking stairs on my project. Thanks to you I also solved this problem by decreasing gravity. Do you know the exact requirements to walk stars = Correlation between camera ellipsoid, scene gravity and camera speed and size of the stairs? Just curious. If you change one of those things it doesn’t work.