Hi All,
I am trying to detect collision in scene. we are placing custom meshes one by one and when we do this, we have to check if placing any mesh collides with any on existing mesh(which are already placed)
I am using
scene.meshes.forEach((mesh) => {
console.log(mesh.name)
mesh.actionManager = new BABYLON.ActionManager();
mesh.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(
{
trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger,
parameter: cylinder1,
},
(event) => {
console.log("collision occured")
}
)
);
});
However using this i can only check collision with only one mesh at a time, i need to check if this collides with any other mesh in the scene
is this the right approach?