Octree manual population

Hello!

I was wondering if there was a way to either:

  • create an Octree manually, such as var octree = new BABYLONJS.Octree(64, 2); and run interesect(), etc calls from it after manually populating it with meshes
  • OR filter out the meshes (by name/id?) when calling scene.createOrUpdateSelectionOctree(capacity, maxDepth).

The reason for my question is that I am trying to detect proximity between the camera and (whatever) meshes, but only meshes of a certain type/family. For example if the camera is inside a particle system, that system should not be taken into account in the proximity check.

Is there a way to do this?

Or a completely different approach worth exploring?

Thanks!

I think these threads can help:

That looks very useful, thanks.

Is there a way to remove a mesh (so the inverse of addMesh)?

edit: duh

Sorry another question. is it possible to add instances to an octree using addMesh()?

Yes, it should work, as addMesh is taking an AbstractMesh as its parameter.