# How to access Actor from Controller C++

**URL:** <https://forums.unrealengine.com/t/how-to-access-actor-from-controller-c/449075>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 16, 2019, 4:27pm UTC](https://forums.unrealengine.com/t/how-to-access-actor-from-controller-c/449075 "2019-05-16T16:27:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack\_W\_Lewis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jack\_W\_Lewis](https://forums.unrealengine.com/u/Jack_W_Lewis)\
**Post date:** [May 16, 2019, 4:27pm UTC](https://forums.unrealengine.com/t/how-to-access-actor-from-controller-c/449075/1 "2019-05-16T16:27:42Z")

</div>

I have a custom player controller and need to access GetActorRotation but it is inaccessible. Am I better off just doing what I need to do in the character class?

---

<div class="post-metadata">

**Author:** ![Chkoupinator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chkoupinator](https://forums.unrealengine.com/u/Chkoupinator)\
**Post date:** [May 17, 2019, 12:05am UTC](https://forums.unrealengine.com/t/how-to-access-actor-from-controller-c/449075/2 "2019-05-17T00:05:18Z")

</div>

You can use GetPawn() to get the Pawn controlled by the Controller (and a Pawn is a subclass of AActor)

---

<div class="post-metadata">

**Author:** ![Jack\_W\_Lewis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jack\_W\_Lewis](https://forums.unrealengine.com/u/Jack_W_Lewis)\
**Post date:** [May 17, 2019, 9:43am UTC](https://forums.unrealengine.com/t/how-to-access-actor-from-controller-c/449075/3 "2019-05-17T09:43:50Z")

</div>

So would GetPawn()-\>GetActorRotation().Vector(); work fine?

---

<div class="post-metadata">

**Author:** ![Chkoupinator](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chkoupinator](https://forums.unrealengine.com/u/Chkoupinator)\
**Post date:** [May 17, 2019, 12:37pm UTC](https://forums.unrealengine.com/t/how-to-access-actor-from-controller-c/449075/4 "2019-05-17T12:37:16Z")

</div>

Yup although you might have to include pawn.h and actor.h (I don’t remember their exact paths but you can find them in the documentation website)
