Add collider to a transform node of a model

Is there a way to add collider to a transform node the same way we can to a mesh? Can a simple box collider be added to such a node?

 BABYLON.SceneLoader.ImportMesh("", "Object/", "Model.glb", scene, function (newMeshes) {

                 node = scene.getTransformNodeByName("Main_Node");
                 node.position = new BABYLON.Vector3(-17, 0.02, 0.02);
                 node.checkCollisions = true; //Can this be done to a node?

            scene.createDefaultEnvironment();
            scene.createDefaultLight();
        });

Unfortunately not that I am aware of, adding @RaananW in case this has been introduced.

A collider requires ellipsoid and bounding info, which a transform node doesn’t have. An empty mesh (or even an AbstractMesh) should work but only if you want it to collide with the world. In order for the camera to collide with any object it requires vertex data (to calculate the collisions :slight_smile: ).

So, TL;dr - sadly not possible with a transform node.

2 Likes