UKismetMathLibrary::ToSign2D
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns a copy of the vector where each component is replaced with its sign: +1 for positive or zero, -1 for negative.
Caveats & Gotchas
- • Zero components are treated as positive (+1), not zero. If you need to detect zero separately, check the component before calling ToSign2D.
- • The result's magnitude is either 1 per component or sqrt(2) total — it is not a unit vector. Do not use the result directly as a normalized direction.
Signature
static UE_INL_API FVector2D ToSign2D(FVector2D A); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector2D | The 2D vector to extract signs from. | — |
Return Type
FVector2D Example
Determine the quadrant of a 2D input axis C++
FVector2D Axis = GetInputAxis2D();
FVector2D Quadrant = UKismetMathLibrary::ToSign2D(Axis);
// Quadrant.X == +1 means right half, -1 means left half Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?