I have 2 objects, I want to copy them by selecting them at the same time

I have 2 objects and I want to copy the objects by selecting them at the same time. In my example, I have 2 objects and I can copy them, but I want the objects to be selected and copied at the same time.

You will have to clone each mesh separately, we don’t have a method to do that (because it’s quite simple: [mesh1, mesh2, ...].forEach((m) => m.clone())).

I am cloning the objects by iterating in the loop and I want to keep the clones in the array and click on the scene, but I cannot see the copy of the objects in the scene. Is there any missing or faulty part in my project?

Your playground has an error, you can see it by opening the dev console and clicking on the select button:
image

How can I add the dragover event? I want it to work with the blue area logic used in Windows.

clone() create the mesh at the same location than the source mesh. If you want to see it, you should update its position property.

2 Likes

You are inside the BJS canvas. You cannot simply use the windows drag selection to select from the canvas. This is above both the BJS canvas and the browser window. There’s no way you can return this selection to in-app. You need to implement the selection from within the canvas, or at least, within the browser window (and return it to the scene).

1 Like

actually babylonJS has a multi select playground mentioned in the docs under Interacting With Scenes

you can also add some visual feedbacks using action manager (eg: chance mesh visibility on hover)

2 Likes