UKismetMathLibrary::Subtract_QuatQuat
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPure
Description
Subtracts quaternion B from A component-wise (A - B). Like Add_QuatQuat, the result is not a unit quaternion.
Caveats & Gotchas
- • The result is not a valid rotation quaternion until normalized; passing it directly to SetActorRotation or similar functions will produce unexpected results.
- • Quaternion subtraction is rarely the right tool for rotation math. For finding the rotation difference between A and B, use B.Inverse() * A (or Multiply_QuatQuat with an inverse) instead.
Signature
static UE_INL_API FQuat Subtract_QuatQuat(const FQuat& A, const FQuat& B) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FQuat& | The quaternion to subtract from. | — |
| B | const FQuat& | The quaternion to subtract. | — |
Return Type
FQuat Example
Component-wise subtraction for custom blending C++
FQuat Diff = UKismetMathLibrary::Subtract_QuatQuat(TargetQuat, SourceQuat);
Diff.Normalize(); // Must normalize before use as rotation Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?