UKismetMathLibrary::Quat_VectorForward
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the forward direction (local X axis) after applying this quaternion's rotation. Identical in result to Quat_GetAxisX; offered as a semantic alias for Blueprint readability.
Caveats & Gotchas
- • This is functionally identical to Quat_GetAxisX — both rotate FVector(1,0,0) by Q. In C++ prefer whichever name is clearer; in Blueprint prefer 'Vector Forward' which has a more descriptive display label.
- • The result depends on UE's convention that forward = +X. Code ported from other engines expecting forward = -Z will need to swap axes.
Signature
static UE_INL_API FVector Quat_VectorForward(const FQuat& Q); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Q | const FQuat& | The quaternion representing the orientation. | — |
Return Type
FVector Example
Spawn effect in front of an oriented object C++
FQuat TurretQuat = TurretMesh->GetComponentQuat();
FVector Forward = UKismetMathLibrary::Quat_VectorForward(TurretQuat);
FVector MuzzlePos = TurretMesh->GetComponentLocation() + Forward * MuzzleOffset;
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), MuzzleFlash, MuzzlePos); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?