Skip to content

UMageItWorldMarkersLibrary

Base Class: UBlueprintFunctionLibrary

UMageItWorldMarkersLibrary is a library of static functions accessible globally across your project. It contains complex mathematics for converting 3D coordinates (World Space) into 2D screen coordinates (Screen Space), as well as algorithms for building KD-trees used for spatial optimization of markers.

Because it inherits from UBlueprintFunctionLibrary, you do not need to instantiate this class or keep a reference to it; the functions are readily available anywhere in Blueprints or C++.


(Blueprint Pure)

The core mathematical function of the plugin. It transforms a given 3D world point into a 2D screen coordinate, taking into account the marker’s size, screen safe zones, and edge-clamping behavior.

Inputs:

  • Player (ULocalPlayer): The local player whose view (camera) is used to calculate the projection.
  • UIScale (Float): The current UI scale factor.
  • WorldPosition (FVector): The 3D world-space coordinate of the object or marker to project.
  • MarkerSize (FVector2D): The dimensions of the marker widget (used for accurate bounds and gap calculations).
  • bStickToViewport (Boolean): If true, the marker will clamp (stick) to the edges of the screen when the target is off-screen. If false, the marker typically disappears or ignores screen boundaries.
  • ScreenGaps (FMargin): The padding (margins) from the screen edges beyond which the marker cannot cross.

Outputs:

  • Return Value (Boolean): Returns true if the projection was successful.
  • ScreenPosition (FVector2D): The resulting 2D screen-space coordinate where the widget should be placed.
  • Angle (Float): The target angle (in degrees) pointing towards the off-screen object. Highly useful for rotating directional arrow pointers at the edge of the screen.
  • SquaredDistanceFromCenter (Float): The squared distance from the screen center to the marker (provided for performance-friendly distance checks).
  • ScreenSide (ETargetScreenSide): An Enum value indicating which side of the screen the marker is currently on (Top, Bottom, Left, Right).

(Blueprint Pure)

Creates an optimized marker tree structure for fast spatial queries or clustering.

Inputs:

  • Markers (Array<UMageItWorldMarkerComponent*>): An array of marker components to include in the tree.

Outputs:

  • Return Value (UMageItMarkersTree*): The generated marker tree object.

The following functions are not exposed to Blueprints and are intended strictly for internal C++ usage.

static FTreeNode* BuildKdTree(TArray<UMageItWorldMarkerComponent*> Markers, int Depth);