RealDocs

UKismetMathLibrary::Quat_GetAxisX

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticUFUNCTIONBlueprintPure

Description

Returns the forward direction (local X axis) of the coordinate frame represented by this quaternion. Equivalent to rotating FVector::ForwardVector (1,0,0) by Q.

Caveats & Gotchas

  • This returns the forward direction in UE's left-handed coordinate system where X is forward. If you're working with physics or geometry tools that expect a different convention, account for the axis mapping.
  • The quaternion must be a unit quaternion for the result to be a unit vector. If Q came from user data or accumulated transforms, normalize it first with Quat_Normalize.

Signature

static UE_INL_API FVector Quat_GetAxisX(const FQuat& Q);

Parameters

Name Type Description Default
Q const FQuat& The quaternion representing the orientation.

Return Type

FVector

Example

Aim a projectile along the actor's forward vector C++
FQuat ActorQuat = GetActorQuat();
FVector Forward = UKismetMathLibrary::Quat_GetAxisX(ActorQuat);

FVector LaunchVelocity = Forward * ProjectileSpeed;
Projectile->GetMovementComponent()->Velocity = LaunchVelocity;

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.