Blender ui collisions not working properly

I designed ui in blender and import the babylon but my camera get stuck in the wall. Wall collisions not working properly. what should I do?

BABYLON.SceneLoader.ImportMesh("", "assets/", "room.glb", scene, function (meshes) { 
  const room = meshes[0]; 
  room.scaling.set(4, 4, 4);
  room.position.set(0, 0, 0);  
  meshes.forEach(function(mesh) {
    mesh.checkCollisions = true;
    mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.MeshImpostor, { mass: 0, restitution: 0.9 }, scene);

i added room this code block.

What type of Camera do you use?
If you use ArcRotateCamera type, you can check these properties:

camera.checkCollisions = true;
camera.ellipsoid = new BABYLON.Vector3(1, 1, 1);

Also ensure the position of your camera is “not get stuck in the wall”


1 Like

Here is one of the simplest examples with WASD camera moving inside the building -

Note that one doesn’t need any physicsImpostors here, Babylon built-in collision check system is enough in this case.

Also, situations where a camera stucks in the walls may be related to inverted normals, check if they are OK.


I used the free camera but separately I tried the universal camera but it doesn’t work. Maybe I couldn’t make the right design in blender.

Enable “Face Orientation” and check what color is your wall.

It must be blue, if color is red then you must flip normals (If you are going to create instance from mesh then it must be red because babylonjs flip normals for instance).

1 Like