UKismetMathLibrary::GetForwardVector
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the world-space unit vector pointing in the forward (X+) direction for the given rotation. Identical to rotating FVector::ForwardVector by InRot.
Caveats & Gotchas
- • The returned vector is already normalized (unit length). Do not call Normalize() on the result — it's a no-op at best and can introduce floating-point error.
- • If InRot comes from GetActorRotation() on an actor whose RootComponent has a non-identity relative rotation, this may not match the component's actual forward — use USceneComponent::GetForwardVector() instead in that case.
Signature
static ENGINE_API FVector GetForwardVector(FRotator InRot); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InRot | FRotator | The rotation to convert. | — |
Return Type
FVector Example
Spawn a projectile in the actor's forward direction C++
FVector Forward = UKismetMathLibrary::GetForwardVector(GetActorRotation());
FVector SpawnPos = GetActorLocation() + Forward * 100.f;
World->SpawnActor<AMyProjectile>(SpawnPos, GetActorRotation()); See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?