RealDocs

UKismetMathLibrary::Vector_Forward

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

Description

Returns the Unreal Engine world forward direction constant (1, 0, 0), the +X axis.

Caveats & Gotchas

  • Unreal uses a left-handed coordinate system where forward is +X, not +Z or -Z as in some other engines. Mixing up axis conventions when porting from Unity is a common source of bugs.
  • This is the world forward axis, not an actor's local forward. Use AActor::GetActorForwardVector() for the actor's facing direction after any rotation has been applied.

Signature

static UE_INL_API FVector Vector_Forward();

Return Type

FVector

Example

Move actor along world forward axis C++
FVector WorldForward = UKismetMathLibrary::Vector_Forward();
FVector NewLocation = Actor->GetActorLocation() + WorldForward * Speed * DeltaTime;
Actor->SetActorLocation(NewLocation);

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.