Areas to detect events? "Colliders as Triggers "

Hello everyone, I would like to know how babylon.js handle areas to detect events.
Explanation of the concept.
In Godot and unity3D it is possible to create areas to detect objects and in this way be able to create events. These areas are usually bodies that do not react to physics, but can interact with the meshes TO KNOW WHEN “I ENTER THE AREA” / "GOT OUT OF THE AREA “/” IS IN THE AREA ".

The advantage of this is that tags can be used to interact with many valuable objects to create scores or the like.
I saw that in babylon.Js it is possible to intercept objects however it is only with 1.

Is there something like what I mention in babylon.js?

Hey @Ariel_Gimenez

9 times out of 10, everything you need to know is in the documentation.

There’s also an example of how to use triggers in the marble tower demo:

In this example, whenever a marble collides with the killbox, a piece of code is run to dispose of the marble to lazily clean up the scene.

Hope this helps.

Ok, I understand, this would be the code for that.

//add an actionManager to the marble
marble.actionManager = new BABYLON.ActionManager(scene);

//register a new action with the marble's actionManager..this will execute code whenever the marble intersects the "killBox"
    new BABYLON.ExecuteCodeAction(

In this image you can see the plane where to enter the spheres called killBox

I think I have the solution, but I still ask you.

How can I verify the object that enters that area?
How can I do to use tags or labels with many objects?

I’m not sure what you mean by “verify the object that enters the area.”

Are you wanting to detect when any mesh collides with another mesh and then filter to do an operation on different types of meshes?

As it states in the documentation:

Note that the two intersection triggers require you specify a specific mesh

So you’ll have to have different actions for the different types of colliding meshes, rather than filtering.

1 Like

Ok, fine. I would have to give you a concrete example, but now I am not practicing something like that, I would like the area to detect any object using labels. I will create another question when I have an example project.

Thanks to the tip you gave me I was able to solve the problem of creating areas for events.
I think this video is better understood.

So every time the bird passes through the middle area it activates an event such as “add points”, in my case for now I show by console that the area works.
In my case import from Blender3D several meshes with the tag “score” using the official babylon plugins, search the scene for the nodes with that tag and create the container to trigger events in that region. It is necessary to take into account that the objects are children of objects that have physical properties, luckily the engine worked and reacted quite well to this test.
Thank you very much, I leave the sample code.

var Puntajes: BABYLON.Mesh[] = scene.getMeshesByTags("puntos") as BABYLON.Mesh[];//busco el nodo padre que contiene a esas columnas
Puntajes.forEach(i => { //recorro todos esos objetos
    //agrego un action manager a cada columna
    i.actionManager = new BABYLON.ActionManager(scene);//creo el nuevo action manager
    //register a new action with the marble's actionManager..this will execute code whenever the marble intersects the "killBox"
        new BABYLON.ExecuteCodeAction(
            trigger:BABYLON.ActionManager.OnIntersectionEnterTrigger,//cuando nu cuerpo entra a esta area
            parameter:pajaro//cuando el pajaro entra a esta area
                console.log("el pajaro entro al area para los puntos");//muestro este mensaje por consola

I don’t know if I answered you, leave the answer below, thank you very much.