Creating a Simple Space Partitioning Algorithm Using TOctree

You haven’t missed anything. The documentation and implementation don’t match here. At some point during the implementation the Epic devs decided to do it differently and forgot to change the comment accordingly. If I’d have to guess it was probably the consequence of calling AddElementToNode for the existing elements when the new element cannot be added to the node (turning a leaf into an actual node with children). With a single return value the caller would only know about a single ID but not all of them that may have changed.

How do you get the FOctreeElementId(s)? Whenever the element passed to AddElement/AddElementToNode is added to its final node in the octree the STATIC function SetElementId(const ElementType& Element, FOctreeElementId Id) is called on the OctreeSemantics type. The OctreeSemantics needs a few more things besides a SetElementId method. See FNavigationOctreeSemantics in NavigationOctree.h/.cpp for an example provided by the engine. In this example the SetElementId function simply stores the data in a TMap (see NavigationSystem.h). Also note there’s a special FNavigationOctree derived from TOctree and another TOctree in LMOctree.h