UKismetMathLibrary::Quat_GetShortestArcWith
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns a copy of A adjusted so that the rotation delta from the copy to B represents the shortest possible arc, without modifying A. Use this when you need the corrected value but must preserve the original.
Caveats & Gotchas
- • Unlike Quat_EnforceShortestArcWith, this does not modify A — it returns a new FQuat. Assigning the result back to A is equivalent but allocates a copy; prefer the in-place version in tight loops.
- • The returned quaternion represents the same physical orientation as the original A; only the sign convention may differ. Do not compare components directly with the pre-call value and expect them to match.
Signature
static UE_INL_API FQuat Quat_GetShortestArcWith(const FQuat& A, const FQuat& B); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | const FQuat& | The source quaternion. | — |
| B | const FQuat& | The target quaternion to find the shortest arc toward. | — |
Return Type
FQuat Example
Non-destructive shortest-arc correction C++
FQuat OriginalQuat = SomeComponent->GetComponentQuat();
FQuat TargetQuat = OtherComponent->GetComponentQuat();
FQuat Corrected = UKismetMathLibrary::Quat_GetShortestArcWith(OriginalQuat, TargetQuat);
FQuat Blended = FQuat::Slerp(Corrected, TargetQuat, Alpha); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?