UKismetMathLibrary::NearlyEqual_TransformTransform
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns true if two transforms are within specified tolerances for location, rotation, and scale. The correct alternative to EqualEqual_TransformTransform whenever floating-point accumulation may occur.
Caveats & Gotchas
- • RotationTolerance is applied in quaternion component space, not degrees — a tolerance of 1e-4 corresponds to an extremely small angle difference. For game-logic purposes such as 'close enough to idle pose', consider converting to Euler angles and comparing those instead.
- • The default tolerance of 1e-4 world units is very tight (0.01 cm); for character movement or AI positioning checks, values in the range of 1–10 (cm) are more practical.
Signature
static ENGINE_API bool NearlyEqual_TransformTransform(const FTransform& A, const FTransform& B, float LocationTolerance = 1.e-4f, float RotationTolerance = 1.e-4f, float Scale3DTolerance = 1.e-4f) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FTransform& | First transform to compare. | — |
| B | const FTransform& | Second transform to compare. | — |
| LocationTolerance | float | Maximum allowable difference in world units for position. | 1.e-4f |
| RotationTolerance | float | Maximum allowable difference in radians for rotation. | 1.e-4f |
| Scale3DTolerance | float | Maximum allowable difference per axis for scale. | 1.e-4f |
Return Type
bool Example
Detect that an object snapped back to rest pose C++
if (UKismetMathLibrary::NearlyEqual_TransformTransform(CurrentTM, RestTM, 1.0f, 0.01f, 0.001f))
{
bIsAtRest = true;
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?