Skip to content

UMageItMarkersTree

Base Class: UObject

UMageItMarkersTree is a specialized data structure object that holds a generated KD-Tree of your world markers. This object is typically created using the BuildMarkersTree function from the UMageItWorldMarkersLibrary.

By storing markers in this tree, you can perform highly optimized spatial queries—like finding all markers within a specific radius or bounding box—without the severe performance cost of looping through every single marker in the game and calculating distances manually. This is especially useful for clustering overlapping markers on the screen or minimap.


These functions allow you to query the tree directly from Blueprints. Because they use optimized tree traversal, they are extremely fast and suitable to be called on a Tick if necessary.

Finds all markers located strictly inside a specified spherical area.

Inputs:

  • Target (FVector): The 3D world-space center point of the search sphere.
  • Radius (Float): The radius of the search sphere.

Outputs:

  • OutResults (Array<UMageItWorldMarkerComponent*>): An array populated with all markers found within the specified radius.

Finds all markers located strictly outside a specified spherical area. Useful for culling or applying different logic to distant markers.

Inputs:

  • Target (FVector): The 3D world-space center point of the exclusion sphere.
  • Radius (Float): The radius of the exclusion sphere.

Outputs:

  • OutResults (Array<UMageItWorldMarkerComponent*>): An array populated with all markers found outside the specified radius.

Finds all markers located within a specific 3D bounding box (FBox). This is particularly useful for frustum culling or selecting markers within a rectangular selection area.

Inputs:

  • QueryBox (FBox): The 3D bounding box defining the minimum and maximum extents of your search area.

Outputs:

  • OutResults (Array<UMageItWorldMarkerComponent*>): An array populated with all markers found within the bounding box bounds.

If you are working in C++, you have direct access to the underlying tree nodes and the static traversal functions.

  • FTreeNode* Root A raw pointer to the root node of the generated KD-Tree. You can use this to write your own highly specialized, custom traversal algorithms if the default spherical or box searches do not fit your exact needs.

The class includes static versions of the search functions that take a raw FTreeNode* as an argument. These are used internally by the Blueprint functions but can be called directly in C++ to avoid any Blueprint overhead or to traverse sub-sections of the tree:

static void RadiusSearch(FTreeNode* Node, const FVector& Target, float Radius, TArray<UMageItWorldMarkerComponent*>& OutResults);
static void RadiusOutsideSearch(FTreeNode* Node, const FVector& Target, float Radius, TArray<UMageItWorldMarkerComponent*>& OutResultsInner);
static void RangeSearch(const FTreeNode* Node, const FBox& QueryBox, TArray<UMageItWorldMarkerComponent*>& OutResults);