Remove multiple meshes based on a radius

Hello,

I would like to delete several meshes according to a given radius.

For the moment in this PG, we can paint several mesh and with CTRL this removes a single mesh. The function is line 159.

Does anyone know how to do it please.

https://www.babylonjs-playground.com/#DJQYJW#18

Thank you in advance.

Hey
you can use mesh.getBoundingInfo().intersects()

This function accept anopther boundingInfo that you can create from two vectors (that defines a box): BoundingInfo - Babylon.js Documentation

1 Like

I’m trying but I don’t understand how to use this getBoundingInfo().intersects() function

Using distance :slight_smile:
https://www.babylonjs-playground.com/#DJQYJW#19

Changed

- if(pickInfo.pickedMesh != this.ground) {
+ if(pickInfo.pickedPoint) {
  this.removePaintFolliage..

and recoded removePaintFolliage function

3 Likes

It works well. This is exactly what I was looking for.
Thank you so much aWeirdo

I did some retouching :
https://www.babylonjs-playground.com/#DJQYJW#21