# AIController::MoveTo Is Very Innacurate

Hi All, I’m working on a simple RTS prototype, and my units are using their own AI controller for the movement. I’m using AIController::MoveTo() for movement, but my unit never really reaches the exact destination point. Ideally I’d like the origin of my unit to be a few cm around the destination. The acceptance radius set in my FAIMoveRequest is set to default -1.f. Changing it to a positive value only makes it worse.

I’d appreciate any help on this.

Thank you.

What happens when you try smaller negative values, like -0.01?

Hi , thank you for your reply. I found a temporary work around, unfortunately it’s not the solution I wanted. Reducing the acceptance radius doesn’t change the accuracy. In the way MoveTo is currently implemented, your character’s radius (in most cases the CapsulComponent’s radius) plus the acceptance radius gives you the closest you’ll ever get to your destination point. To test this out, I reduced the radius of my character’s CapsuleComponent to 1.f, and tried to set a new destination. Unsurprisingly my character’s origin is now approx. 1cm away from the set destination point. Reducing the capsule component’s diameter has a number of implications though, so I will try to work on a more reasonable solution. Will update if I find something.

For a somewhat hacky solution, you might consider moving to the target location plus half of your capsule component’s radius, on the xz plane. If there’s a possibility of height difference, you don’t want the target going into the ground/in the air.

You can get the “flat” direction to add this offset to by setting the Y component of the direction to the actor to 0 and normalizing the resulting vector. Multiply this by half the radius of the capsule component, and add it to the MoveTo target location.

That’s a very good idea and it can definitely work. What makes it a bit more complicated is the fact that there are four quadrants in the 2D xy system, meaning that I’ll need to do some transforms before adding the capsule component’s radius to the destination. Alternatively I can restrict all my levels to only one of the quadrants (let’s say (+,+)).

OK, I’m blind, it’s all in the documentation. One of the parameters of the function AIController::MoveTo is bStopOnOverlap. The documentation reads: “add pawn’s radius to AcceptanceRadius”. In my code it was set to true. Setting it to false allows the pawn to move closer to set destination, since the stop movement function is not called when the capsule component overlaps said point. It’s still not as accurate as I’d like, but I can work with that!