GetActorForwardVector & GetActorRightVector point in the same direction

I expected these two vectors to be perpendicular to each other.
However, they point in the same direction.
Also when the pawn turns the vectors does not move.

this is the code:

DrawDebugLine(GetWorld(), NPC->GetActorLocation(),  NPC->GetActorForwardVector()*100.0f, FColor::Red, false, 1.0f, 0, 3.0f);
DrawDebugLine(GetWorld(), NPC->GetActorLocation(), NPC->GetActorRightVector()*100.0f, FColor::Blue, false, 1.0f, 0, 3.0f);

What’s wrong?
Any other way to get the vectors that point forward and to the right always with respect to the pawn’s position and rotation?

Thank you so much!!

1 Like

You’ve drawn the line from the actor location to the origin, roughly. You need to add the vectors to get the destination point

DrawDebugLine(GetWorld(), NPC->GetActorLocation(),  NPC->GetActorLocation() + ( NPC->GetActorForwardVector()*100.0f ), FColor::Red, false, 1.0f, 0, 3.0f);
2 Likes

Now I think I’m dumb… :rofl: :rofl:

Thank you very much for the help @ClockworkOcean

Can I ask one more question?

I’m trying to rotate the vector forward.

float Azimuth=0.0f;
float Elevation=0.0f;

const FVector Direction = UKismetMathLibrary::GetDirectionUnitVector( NPC->GetActorLocation(), Enemy->GetActorLocation());

UKismetMathLibrary::GetAzimuthAndElevation(Direction, NPC->GetActorTransform(), Azimuth, Elevation);

const FVector RotatedForwardVector = UKismetMathLibrary::RotateAngleAxis( NPC->GetActorForwardVector(), -Elevation,	 NPC->GetActorRightVector() );

However the vector (RotatedForwardVector) does not point where it is supposed (to the enemy).
The pawn always looks at the enemy (It is focused). It’s a problem with the height difference only.

I thought there was a problem with
GetActorForwardVector() & GetActorRightVector()
But your answer shows that they work well.

Maybe I’m doing something wrong?

1 Like

If you want to look at something, then you can just use ‘find look at rotation’?

1 Like

I will try it…thanks a lot!!

1 Like