# GetActorForwardVector & GetActorRightVector point in the same direction

**URL:** <https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236>\
**Category:** C++\
**Tags:** unreal-engine, CPP, question\
**Created:** [December 27, 2024, 9:27am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236 "2024-12-27T09:27:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [December 27, 2024, 9:27am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236/1 "2024-12-27T09:27:50Z")

</div>

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:

```auto
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);

```

 ![10](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/8/9/889739501dc7849743241cc10add9d9fd37055db.png)

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!!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 27, 2024, 9:42am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236/2 "2024-12-27T09:42:05Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [December 27, 2024, 9:58am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236/3 "2024-12-27T09:58:11Z")

</div>

Now I think I’m dumb… 🤣 🤣

Thank you very much for the help @ClockworkOcean

Can I ask one more question?

I’m trying to rotate the vector forward.

```auto
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?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 27, 2024, 10:08am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236/4 "2024-12-27T10:08:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [December 27, 2024, 10:11am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236/5 "2024-12-27T10:11:37Z")

</div>

I will try it…thanks a lot!!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 26, 2025, 10:12am UTC](https://forums.unrealengine.com/t/getactorforwardvector-getactorrightvector-point-in-the-same-direction/2245236/6 "2025-01-26T10:12:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
