Detect intersect merged mesh

can i detect mesh intersection on merged mesh ?

I want to detect intersections only when the sphere hits objects on the joined mesh only


Perhaps I don’t understand? Would you not want to just check the individual collisions for each mesh?

if(ball.intersectsMesh(box,true) || ball.intersectsMesh(box2,true)) {

You could even use for for loop to iterate over the array of meshes if you had more.

To be more exact, it is possible if original meshes were not disposed (and they are disposed by default).
In order not to dispose them you need to put the second parameter disposeSource = false (true by default).

var newMesh = BABYLON.Mesh.MergeMeshes(arrayOfMeshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes, multiMultiMaterials);

yes i know,but in my project, i need to detect intersection on merged mesh… it’s possible to do that?

Here is your PG with Inspector:

Line 29, changed from true to false:

`var newMesh = BABYLON.Mesh.MergeMeshes([box2,box], false);`

As you see, now you have all original meshes as you need.

yeah, I understand.
that’s just an example that I made to describe the case in my project. In my project there are imported objects that are merged, and I want to detect intersections of these objects, as in the example

I suppose this is the solution (maybe a bit simplified, but seems that it detects intersections as you want).