UKismetMathLibrary::Vector4_IsUnit3
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Returns true if the XYZ components of the vector have a squared length within SquaredLenthTolerance of 1.0, ignoring W. Use this as a fast unit-length guard before operations that require a normalized direction.
Caveats & Gotchas
- • Note the typo in the parameter name — 'SquaredLenthTolerance' (missing 'g') matches the actual C++ declaration; don't be surprised if autocompletion shows the misspelled name.
- • W is not tested; a vector with W far from 0 or 1 can still pass this check, so it does not validate homogeneous coordinate conventions.
Signature
static UE_INL_API bool Vector4_IsUnit3(const FVector4& A, float SquaredLenthTolerance = 1.e-4f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FVector4& | The vector to test. | — |
| SquaredLenthTolerance | float | Allowed deviation from 1.0 in squared length. Default 1e-4. | 1.e-4f |
Return Type
bool Example
Assert direction is normalized before use C++
FVector4 Dir = GetSomeDirection();
ensure(UKismetMathLibrary::Vector4_IsUnit3(Dir));
// Safe to use Dir as a unit direction Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?