How can I find all triangles in a scene that fall inside a 3D box?

What I want to achieve is to find a list of triangles in a scene which may possibly intersect with a given triangle. What I was hoping to do was use the bounding box of the given triangle and then use that to search the scene using a triangles octree and the BoxCollision method.

In my scenario there is the possibility that multiple triangles should be found inside or intersecting the bounding box, but the BoxCollision method only returns a single triangle.

Is this the wrong method to use? Is there another built in way to achieve this? Or will I have to derive a new Octree with this functionality?

Many thanks!

Oh, I see I answered this one in How to efficiently find which triangles in a scene might intersect a given triangle? - #2 by michalis :slight_smile:

In short: BoxCollision is not what you need, you have to create what you need (like AllBoxCollisions method I suggest in the linked answer). It can indeed follow some logic of BoxCollision, just not exit early, instead call something (e.g. user-provided callback) for each triangle.

Iā€™m sure you can leverage the existing octree structure to achieve this.

Possibly you can even do this from a unit outside of CGE, imlementing AllBoxCollisions on an octree given as a parameter. Though Iā€™m not 100% sure about this, if need be ā€“ modifying CGE to add AllBoxCollisions also makes sense, and we would welcome such PR :slight_smile: