RealDocs

AActor::GetActorForwardVector

function Engine Blueprint Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: constUFUNCTIONBlueprintCallable

Description

Returns the unit forward vector (local +X axis) of this actor in world space, derived from the RootComponent's world rotation.

Signature

FVector GetActorForwardVector() const

Return Type

FVector

Caveats & Gotchas

  • Returns FVector::ForwardVector (1,0,0) if the actor has no RootComponent — which can silently give wrong results for actors spawned without a scene root.
  • The result changes every frame for rotating actors. Cache it locally if you call it multiple times within the same frame.

Example

Move in the actor's forward direction C++
FVector NewLoc = GetActorLocation() + GetActorForwardVector() * Speed * DeltaTime;
SetActorLocation(NewLoc);

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.