RealDocs

UKismetMathLibrary::Quat_GetAxisY

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

Description

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

Caveats & Gotchas

  • In UE's coordinate system Y points right. If you need to strafe a character, this gives the correct strafing direction without converting through FRotator.
  • The result is only a unit vector if Q is normalized. Non-unit quaternions (e.g. from accumulated floating-point drift) will produce scaled axis vectors.

Signature

static UE_INL_API FVector Quat_GetAxisY(const FQuat& Q);

Parameters

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

Return Type

FVector

Example

Apply lateral force relative to orientation C++
FQuat ActorQuat = GetActorQuat();
FVector Right = UKismetMathLibrary::Quat_GetAxisY(ActorQuat);
GetMovementComponent()->AddForce(Right * LateralForce);

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.