# MoveToActor and MoveToLocation Not Working in C++

**URL:** <https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577>\
**Category:** C++\
**Tags:** ai-controller, unreal-engine, CPP, question\
**Created:** [February 10, 2017, 9:50pm UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577 "2017-02-10T21:50:37Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![calembendell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@calembendell](https://forums.unrealengine.com/u/calembendell)\
**Post date:** [February 10, 2017, 9:50pm UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/1 "2017-02-10T21:50:37Z")

</div>

I have the following bit of code in my class extending AAIController:

```
	UE_LOG(LogTemp, Warning, TEXT("MOVING TOWARDS CHARACTER %s AT POSITION %s"), *TargetedCharacter->GetName(), *TargetedCharacter->GetActorLocation().ToString());
	MoveToLocation(TargetedCharacter->GetActorLocation());

```

The log successfully prints out

LogTemp:Warning: MOVING TOWARDS CHARACTER Ash\_C\_0 AT POSITION X=-954.872 Y=134.872 Z=190.150  
LogTemp:Warning: MOVING TOWARDS CHARACTER Ash\_C\_0 AT POSITION X=-852.143 Y=32.144 Z=190.150  
LogTemp:Warning: MOVING TOWARDS CHARACTER Ash\_C\_0 AT POSITION X=-745.443 Y=-74.557 Z=190.150

But my character does not move.  
So I tried to run MoveToLocation from BeginPlay, and there is still no movement.

However, if I run seemingly the exact same bit of code from Blueprints with a Blueprint extending AI Controller, like so:

 ![125789-rubbishblueprints.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/9/7/697d9a43ffe94c6d05b39ce228ad686aceef5246.png)

The character will move to the location.

It seems very much like calling these functions from C++ is broken.  
If there’s a way to fix this so that I could avoid Blueprints that would be wonderful!  
If not, is there another workaround?

Update: I can also see here that when I use the C++ call, the status for the character is set to moving and there is a goal with a path and a path end.

 ![125804-statusmoving.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/5/2355de363a9e257a93ee277fa73cb16fd999c445.jpeg)

Thanks!

---

<div class="post-metadata">

**Author:** ![calembendell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@calembendell](https://forums.unrealengine.com/u/calembendell)\
**Post date:** [February 13, 2017, 2:18am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/2 "2017-02-13T02:18:42Z")

</div>

bumpity bump

---

<div class="post-metadata">

**Author:** ![Holybreath](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Holybreath](https://forums.unrealengine.com/u/Holybreath)\
**Post date:** [February 13, 2017, 10:31am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/3 "2017-02-13T10:31:27Z")

</div>

can you send your actor to {0,0,0} as well in c++? may be because of the Z being 190 (up in the air) it thinks its an unreachable place so wont go.

---

<div class="post-metadata">

**Author:** ![calembendell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@calembendell](https://forums.unrealengine.com/u/calembendell)\
**Post date:** [February 14, 2017, 4:26am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/4 "2017-02-14T04:26:11Z")

</div>

Character still doesn’t move when sent to {0, 0, 0}, sadly. But man I’d hoped that was it.

---

<div class="post-metadata">

**Author:** ![Holybreath](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Holybreath](https://forums.unrealengine.com/u/Holybreath)\
**Post date:** [February 14, 2017, 7:08am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/5 "2017-02-14T07:08:11Z")

</div>

Ok, from the docs [AAIController::MoveToLocation | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/API/Runtime/AIModule/AAIController/MoveToLocation/index.html) Can you overload the MoveToLocation, upto a point where you can give it a bUsePathfinding value? seems like that is enabled in blueprint, so i think thats the reason

---

<div class="post-metadata">

**Author:** ![calembendell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@calembendell](https://forums.unrealengine.com/u/calembendell)\
**Post date:** [March 2, 2017, 2:52am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/6 "2017-03-02T02:52:38Z")

</div>

Creating a new project and redoing everything did the trick.  
I still don’t know what was wrong, but if I figure it out, I"ll post it.

---

<div class="post-metadata">

**Author:** ![calembendell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@calembendell](https://forums.unrealengine.com/u/calembendell)\
**Post date:** [March 2, 2017, 2:53am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/7 "2017-03-02T02:53:04Z")

</div>

thanks for the help dude! this ended up not doing the trick, but i appreciate it.

---

<div class="post-metadata">

**Author:** ![TigerFish89](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TigerFish89](https://forums.unrealengine.com/u/TigerFish89)\
**Post date:** [September 9, 2017, 4:31pm UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/8 "2017-09-09T16:31:18Z")

</div>

Did you solve it? I have a same problem

---

<div class="post-metadata">

**Author:** ![emperor\_katax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/emperor_katax/32/1070178_2.png) [@emperor\_katax](https://forums.unrealengine.com/u/emperor_katax)\
**Post date:** [April 8, 2018, 11:38am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/9 "2018-04-08T11:38:27Z")

</div>

… I got same issue and then discover I didn’t add “Nav Mesh Bounds Volume” to my stage. … after I add it, things roles sweet … ; ] ,

---

<div class="post-metadata">

**Author:** ![SirMike](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SirMike](https://forums.unrealengine.com/u/SirMike)\
**Post date:** [July 14, 2018, 11:08am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/10 "2018-07-14T11:08:29Z")

</div>

I know I can be late to the party but encountered exactly the same thing. Problem of course was in my code where I was not calling `Super::BeginPlay()` in my AIController `BeginPlay` override. I hope it helps somebody.

---

<div class="post-metadata">

**Author:** ![JJFawkes](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JJFawkes](https://forums.unrealengine.com/u/JJFawkes)\
**Post date:** [March 29, 2019, 1:09pm UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/11 "2019-03-29T13:09:24Z")

</div>

Thanks, it solved my issue.

---

<div class="post-metadata">

**Author:** ![NicolasNucifora](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/nicolasnucifora/32/570281_2.png) [@NicolasNucifora](https://forums.unrealengine.com/u/NicolasNucifora)\
**Post date:** [February 25, 2022, 1:06am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/12 "2022-02-25T01:06:57Z")

</div>

Man, you saved my life. I was looking for a solution about ai character not chasing my character and it was due Super::BeginPlay() was missing on my AI COntroller. Thank you a lot!

---

<div class="post-metadata">

**Author:** ![amdude\_00](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@amdude\_00](https://forums.unrealengine.com/u/amdude_00)\
**Post date:** [April 17, 2025, 12:59am UTC](https://forums.unrealengine.com/t/movetoactor-and-movetolocation-not-working-in-c/384577/13 "2025-04-17T00:59:31Z")

</div>

this worked for me. thank you.
