Finding nodes

Hello,

I am currently working on a simple Octree visualization. Something along the lines of this example UE_Space_Partioner_Using_TOctree/SpacePartioner.cpp at master · StenBone/UE_Space_Partioner_Using_TOctree · GitHub

The problem is that example uses the deprecated TOctree. seems to be sub-optimal documented for me.

Finding elements is rather straight forward with FindAllElements.

My problem is more how to get all nodes. Any tips? I know I probably have to use this one: TOctree2::FindNodesWithPredicate | Unreal Engine Documentation

Anyhow I dont seem to get this to work. Do you know any examples I can take a look at? It does not seem that there are too many examples of existing.

Best

Found an example in unreal engine code within the file: ShadowSetup.ccp
In case somebody else is looking for an example.

Visualisation of the Octtree

//Predicate returns true for all the nodes.
auto AllNodesPredicate = [](FMyOctree::FNodeIndex /*ParentNodeIndex*/, FMyOctree::FNodeIndex /*NodeIndex*/, const FBoxCenterAndExtent& /*NodeBounds*/) -> bool
{
	return true;
};

MyOctree.FindNodesWithPredicate(
	AllNodesPredicate,
	[&](FMyOctree::FNodeIndex /*ParentNodeIndex*/, FMyOctree::FNodeIndex /*NodeIndex*/, const FBoxCenterAndExtent& NodeBounds)
{
	FBox BoxBounds = NodeBounds.GetBox();
	DrawDebugBox(GetWorld(), BoxBounds.GetCenter(), BoxBounds.GetExtent(), FColor::Green, false, 0.1f, 0, 6.0f);
});