UKismetMathLibrary::Quat_VectorUp
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the up direction (local Z axis) after applying this quaternion's rotation. Semantic alias for Quat_GetAxisZ.
Caveats & Gotchas
- • Functionally identical to Quat_GetAxisZ. Choose based on readability in context — 'Vector Up' communicates intent more clearly in Blueprint graphs that work with surface normals or gravity alignment.
- • For physics-based characters that can be tilted (wall-running, planetary gravity), this will not match world up. Cache the result if you call it multiple times per frame.
Signature
static UE_INL_API FVector Quat_VectorUp(const FQuat& Q); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Q | const FQuat& | The quaternion representing the orientation. | — |
Return Type
FVector Example
Align a surface-hugging enemy to wall normal C++
FHitResult Hit;
FVector TraceStart = GetActorLocation();
FVector TraceEnd = TraceStart - FVector(0, 0, 200.f);
if (GetWorld()->LineTraceSingleByChannel(Hit, TraceStart, TraceEnd, ECC_WorldStatic))
{
FQuat AlignedQuat = FQuat::FindBetweenNormals(FVector::UpVector, Hit.ImpactNormal);
FVector LocalUp = UKismetMathLibrary::Quat_VectorUp(AlignedQuat);
SetActorRotation(AlignedQuat.Rotator());
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?