UKismetMathLibrary::Vector_IsUniform
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns true if all three components of the vector are equal within the specified tolerance. Typically used to verify uniform scale vectors.
Caveats & Gotchas
- • Checks that all components are equal to each other, not that they equal any particular value — (5, 5, 5) is uniform, (0, 0, 0) is also uniform. Do not use this to check for unit scale (1,1,1); compare against FVector::OneVector instead.
- • The tolerance is an absolute per-pair difference, not relative. For large scale values (e.g., (1000, 1001, 1000)), the default 1e-4 tolerance would report non-uniform, even though the relative difference is tiny.
Signature
static UE_INL_API bool Vector_IsUniform(const FVector& A, float Tolerance = 1.e-4f); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | FVector | The vector to test. | — |
| Tolerance | float | Maximum allowed absolute difference between any two components. Defaults to 1e-4. | 1.e-4f |
Return Type
bool Example
Warn when non-uniform scale is applied to a mesh C++
FVector Scale = StaticMesh->GetComponentScale();
if (!UKismetMathLibrary::Vector_IsUniform(Scale, 0.01f))
{
UE_LOG(LogTemp, Warning, TEXT("Non-uniform scale on %s may cause physics issues"),
*StaticMesh->GetName());
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?