UMageItWorldMarkersLibrary
Base Class: UBlueprintFunctionLibrary
Overview
Section titled “Overview”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 Functions
Section titled “Blueprint Functions”Project Marker To Screen
Section titled “Project Marker To Screen”(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): Iftrue, the marker will clamp (stick) to the edges of the screen when the target is off-screen. Iffalse, 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): Returnstrueif 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).
Build Markers Tree
Section titled “Build Markers Tree”(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.
C++ Only Utilities
Section titled “C++ Only Utilities”The following functions are not exposed to Blueprints and are intended strictly for internal C++ usage.
BuildKdTree
Section titled “BuildKdTree”static FTreeNode* BuildKdTree(TArray<UMageItWorldMarkerComponent*> Markers, int Depth);