In the Unreal API it describes GetActorForwardVector as “Get the forward (X) vector (length 1.0) from this Actor, in world space”.
Practically, just wasn’t sure what this means. The code below just moves the actor directly north up the screen irrespective of the way its facing.
void AEnemyShip::Tick(float DeltaTime)
Super::Tick(DeltaTime); UE_LOG(LogTemp, Warning, TEXT("actor location is %s"), *GetActorLocation().ToString()); UE_LOG(LogTemp, Warning, TEXT("actor velocity sis %s"), *GetVelocity().ToString()); FVector newVector = GetActorLocation() + currentForwardVector + (.00001 * DeltaTime); SetActorLocation(newVector);
If my Pawn is spawned at position (0, 0, 0) in the world and is rotated to face in the North-East direction (45 degrees) what will be the result of GetActorForwardVector? Is it just the X location?
I guess my next question is if I wish to move the Pawn in the direction its facing (45 degress from north) what do I use? Do I need to find the dot product?
Because at spawning GeVelocity is 0,0,0 so not sure how best to handle this.