# MoveToLocation not working

**URL:** <https://forums.unrealengine.com/t/movetolocation-not-working/460363>\
**Category:** Blueprint\
**Tags:** charactermovementcom, move-to-location, unreal-engine, UE4, Blueprint, CPP, question\
**Created:** [January 9, 2020, 6:33pm UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363 "2020-01-09T18:33:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdul\_Hasan\_Ali](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abdul\_Hasan\_Ali](https://forums.unrealengine.com/u/Abdul_Hasan_Ali)\
**Post date:** [January 9, 2020, 6:33pm UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/1 "2020-01-09T18:33:28Z")

</div>

I have a tank AI that i want to move with MoveToLocation. At first i used a pawn for this but because a pawn’s movement capabilities are less optimized i switched to a character so i could benefit the character movement component. Now the tank does not move anymore. I don’t really know why, but the MoveToLocation just returns ‘Failed’.  
I used a visual logger to collect some data:

 ![295036-failed.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/4/7/e47700d364537abb94eec65ffeef05e18c044983.png)

As you can see, it should move to the red line but it doesn’t. (red line is actually location of the visual logger but since i set the target location to (0,0) it matches the visual logger location)  
I can’t really find a solution for this.  
I also don’t know a lot about the included capsuleComponent in a character class. I have a different mesh set as root of my tank, and i kind of ignore the capsule component. I don’t know if that has to do with the character movement.  
I know also what a navmeshbounds volume is but not what the recast navmesh is for.

My project is actually c++ but this is not a c++ problem. (I added the moveToLocation in blueprint for testing purposes. I print the response each which is “Failed”).  
The AI does do other tasks, like aiming, but not the moving part.

Here is my tank layout.

 ![295038-tank.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/0/d20837cae8d2b654d831725428d4b1dbf279bc9d.png)

Here are the settings of the navigation mesh and system.

 ![295105-navigation-mesh.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/4/5/a455d69cd7f7111432ef8ec2513747d749cc1c55.png)

 ![295106-navigation-system.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/4/8/248e17753d4cc5e267cb3c3432844b12a18e3ec5.png)

Here is the begin play code of the controller

 ![295107-controller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/4/d345979578f5d3df289139b7231ea5861f623832.png)

I can also show all the data of the character movement component, but then i’ll have to remove some other pictures because i can only add 5.

EDIT: When i change, in the charactermovementcomponent settings,“planar movement: constrain to Plane” to true, and set "Plane Constraint Axis Setting to Z, it prints out request successfull, and still does not move. just something i noticed. When i was using a pawn (and when the movement still worked) i did not enable constrain to plane.

---

<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:** [January 10, 2020, 1:20pm UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/2 "2020-01-10T13:20:08Z")

</div>

Can we see the code?

---

<div class="post-metadata">

**Author:** ![Abdul\_Hasan\_Ali](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abdul\_Hasan\_Ali](https://forums.unrealengine.com/u/Abdul_Hasan_Ali)\
**Post date:** [January 10, 2020, 8:08pm UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/3 "2020-01-10T20:08:33Z")

</div>

i’ll add the code now

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_776011b61](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_776011b61](https://forums.unrealengine.com/u/anonymous_user_776011b61)\
**Post date:** [January 11, 2020, 4:00am UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/4 "2020-01-11T04:00:20Z")

</div>

Dd you make a child actor or did you just copy the Character and change the coding?

Regards

---

<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:** [January 11, 2020, 11:28am UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/5 "2020-01-11T11:28:25Z")

</div>

I can’t see anything obvious, but you have setup a lot of stuff and it’s kinda hard to tell where the problem might be. Does this help?:

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/1/7/4172e01a237f9038e8500eb129645bf33b620361.jpeg "WTF Is? AI: Move To Location in Unreal Engine 4 ( UE4 )") ](https://www.youtube.com/watch?v=7n7nJ66I8qg)

---

<div class="post-metadata">

**Author:** ![Abdul\_Hasan\_Ali](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abdul\_Hasan\_Ali](https://forums.unrealengine.com/u/Abdul_Hasan_Ali)\
**Post date:** [January 11, 2020, 11:39am UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/6 "2020-01-11T11:39:57Z")

</div>

I made a new class that inherits from ACharacter. Then i set my own mesh as Root.

---

<div class="post-metadata">

**Author:** ![Abdul\_Hasan\_Ali](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abdul\_Hasan\_Ali](https://forums.unrealengine.com/u/Abdul_Hasan_Ali)\
**Post date:** [January 11, 2020, 11:47am UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/7 "2020-01-11T11:47:33Z")

</div>

Yeah, there are a lot of settings about the navmesh and character movement in general, which makes it very hard to find a mistake which might be 1 checkbox. I have previously watched that video. I’ll try to adjust some settings.  
I’ll probably build a new project and gradually change it to see where it goes wrong. But often, creating a new project just fixes it all.

---

<div class="post-metadata">

**Author:** ![Abdul\_Hasan\_Ali](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Abdul\_Hasan\_Ali](https://forums.unrealengine.com/u/Abdul_Hasan_Ali)\
**Post date:** [January 11, 2020, 3:18pm UTC](https://forums.unrealengine.com/t/movetolocation-not-working/460363/8 "2020-01-11T15:18:42Z")

</div>

I managed to get something to work, but it is not the way i want it to. By setting the CapsuleComponent (that i don’t need) as Rootcomponent, with the tank attached to it. That means it uses the collision of the capsulecomponent.  
This way I can’t use the collision of the tank so I do not prefer it this way, but I don’t know if it is possible without the capsule as root component. if i give the tank component collision, it just ignores it and uses the capsule component’s collision.  
If anyone finds a different solution, let me know ;).  
I’ll make a separate topic on this one.
