UKismetMathLibrary::Square
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns A * A. Equivalent to FMath::Square. Used for squared distances, quadratic curves, and energy calculations.
Caveats & Gotchas
- • The Blueprint compact node shows '^2', which can be confused with an exponentiation operator — it is strictly A*A, not a general power function.
- • For very large float inputs the result can overflow to infinity before you reach the Sqrt step; use double precision inputs or clamp the input range when working with world-scale distances.
Signature
static UE_INL_API double Square(double A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | double | The value to square. | — |
Return Type
double Example
Avoid Sqrt with a squared distance threshold C++
double Radius = 500.0;
double DistSq = FVector::DistSquared(GetActorLocation(), Target->GetActorLocation());
if (DistSq < UKismetMathLibrary::Square(Radius))
{
// Target is within radius
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?