Is there a space-partitioning data structure?

I need to retrieve vertices of a custom mesh in the 3D space. Is there a space-partitioning data structure that I can use, or do I have to make one (instead of going through all vertices)? I saw there are BSP brushes, but can I use the underlying data structure alone?

Mh how can I use it to find the closest point (in the octree) to another point?

Take a look at the TOctree<> class.

I haven’t done that myself. I did see some write ups of the nearest neighbor algorithm for a quadtree. Shouldn’t be too hard to adapt that to work with an octree

How is it used right now (for what purposes) if it cannot retreive points (I could what the FNavigationOctree to understand…)?

The TOctree class is a templated class that you provide some classes to interact with it. You need to do custom work to make this happen, as the octree needs adapters to understand how to partition your data. You can look at the current uses in the engine to get a feel for what needs to be done. Unfortunately, it is too involved to try and answer via a forum post. Your best bet is investigating current uses and learning from those