ULimenMath
Overview
ULimenMath is a Blueprint callable function library that offers a range of mathematical operations useful in game development. It includes functions for rounding numbers, rotating actors and pawns, finding the closest actor or component to a given location, performing cone traces, and more. This class is designed to be used both within Blueprints and C++ code.
Properties
Type | Name | Access | Description |
|---|---|---|---|
EDirection3D[] | AllDirections | Static | A static array containing all possible directions in 3D space. |
EDirection3D[] | TopViewDirections | Static | A static array containing directions that are visible from the top view (Forward, Backward, Left, Right). |
EDirection3D[] | SideViewDirections | Static | A static array containing directions that are visible from a side view (Left, Right, Up, Down). |
Functions
Return Type | Signature | Description |
|---|---|---|
int64 | RoundToNearestInteger(const double Value) | Rounds a floating point number to the nearest integer value. |
double | RoundToNearestDouble(const double Value, const uint8 NumDecimals = 2) | Rounds a floating point number to the nearest value specified number of decimals. |
void | RotateActorAroundPoint(AActor* Actor, const FVector Point, const double DegreeRotation, const FVector Axis = FVector(0.f, 0.f, 1.f)) | Rotates an actor around a given point by a specified degree and axis. |
bool | RotatePawnAroundPoint(AController* Controller, const FVector Point, const double DegreeRotation, const FVector Axis = FVector(0.f, 0.f, 1.f)) | Rotates a pawn controlled by a controller around a given point by a specified degree and axis. |
FTransform | RotatePointAroundPoint(const FVector Point, const FVector RotationCenter, const double DegreeRotation, const FVector Axis = FVector(0.f, 0.f, 1.f)) | Returns the transform of a point after rotating it around a center point by a specified degree and axis. |
FTransform | RotateTransform(const FTransform TransformToRotate, const FVector RotationCenter, const double DegreeRotation, const FVector Axis = FVector(0.f, 0.f, 1.f)) | Rotates a given transform around a center point by a specified degree and axis. |
AActor* | GetClosestActorTo(const FVector& Location, const TArray<AActor*>& ActorsList) | Finds the closest actor to a given location from a list of actors. |
AActor* | GetClosestActorOfClassTo(const FVector& Location, const TArray<AActor*>& ActorsList, const TSubclassOf & InClass) | Finds the closest actor of a specific class to a given location from a list of actors. |
UPrimitiveComponent* | GetClosestComponentsTo(const FVector& Location, const TArray<UPrimitiveComponent*>& ComponentsList, float& OutClosestDistanceSquared) | Finds the closest component to a given location from a list of components and returns the distance squared. |
bool | ConeTraceMultiByProfile(const UWorld* World, const FConeData& InConeData, const FName& ProfileName, TArray & OutHits, const FCollisionQueryParams& QueryParams, const FCollisionResponseParams& ResponseParams, const float TraceResolution, const bool bThreadSafe = true) | Performs a cone trace using a specified profile and returns the hits. |
bool | IsInteger(const double Test) | Checks if a floating point number is an integer. |
FRotator | ClampToMajorAxis(const FRotator InRotator) | Clamps a rotator to the nearest major axis (10deg = 0deg; 150deg == 180deg). |
float | QuantizeWithHysteresis(const float AngleDegrees, const float StepDegrees, const float HysteresisDegrees, float& LastSnapDegrees) | Quantizes an angle with hysteresis. |
float | SignedAngleAroundAxis(const FVector& From, const FVector& To, const FVector& Axis) | Calculates the signed angle between two vectors around a specified axis. |
Usage & Implementation Notes
The
RotateActorAroundPointandRotatePawnAroundPointfunctions use Unreal Engine'sFRotatorandFTransformto handle rotations accurately.The
ConeTraceMultiByProfilefunction performs multiple sweeps along the cone's height, checking for collisions with the specified profile.The
IsIntegerfunction checks if a number is an integer by comparing it to its rounded value.The
ClampToMajorAxisfunction clamps each axis of a rotator to the nearest major axis (0, 90, 180, or 270 degrees).The
QuantizeWithHysteresisfunction quantizes an angle with hysteresis to prevent rapid changes when crossing snap points.