'Move to Location' offset issue in Behavior Trees

Hi, I’m working on grid based movement in my game. I’m using the camera as the default player character, while having all the player controlled characters and AI characters being controlled by AI controllers. Until recently, I had used the default blueprints to handle the movements. Since I’m using AI controllers, I could use the ‘Move to Location’ to let my characters reach the exact destination, unlike the ‘Simple Move to Location’ which always has an offset. So here’s a screenshot of what I’ve been doing before I got into Behavior Trees.

You may notice that I’m using Behavior Trees here as well. But that is only to check if it has reached the Movement goal. The actual movement is handled from the outside blueprint as shown in the screenshot.

And everything was working perfectly, as seen below. The units are moving to the center of the grid, which is what I want to happen.

Today, I tried putting the movement code inside the blueprint. Initially I used the ‘Move To’ task inside the Behavior Tree. In spite of acceptance radius being set to low values like 0.0 and 1.0, the character was not reaching the exact destination point. Here’s a screenshot of that:

So thinking that this movement might be handled similar to ‘Simple Move to Location’, I made a new task for movement. I got my AIController class and used ‘Move to Location’, with the same conditions as my previous Blueprint based settings. Low acceptance radius, and no overlap conditions.

However I’m still facing the same movement offset issue. I’m using the same code under both conditions, yet the results are different. Is there any way to get the ‘Move to Location’ working inside Behavior Trees? Or am I doing something wrong with the code here?

It’s a known issue and it has been fixed in 4.7. Please give it a try once it’s out, or try using latest 4.7 preview build, and let me know how it went.

Cheers,

–mieszko

Awesome!! Thanks man, I’m downloading the preview build. Should be done by tomorrow. I’ll check and let you know.

Hi, I’ve downloaded the 4.7 preview 4 for testing it out. Unfortunately, the behavior tree movement is still causing an offset. I have not tried it out in a new project in 4.7, I just used the same project that I was using earlier in 4.6.

Sure, no issue man. Thanks for the code, I’ll try it out in my local engine source for now.

I’ve just tested it and you’re totally right! Quick investigation showed that there are simply parameters missing in BT’s movement tasks, namely StopOnOverlap. I’ve just fixed it so you can either try to use master branch from the github, wait for this change make it to the promoted branch, or wait for 4.8 with this (it’s too late to squeeze something this minor to a almost closed version, sorry!).

Or you can just take this one change and apply it to your local engine sources - it’s really small!

Hi, just one more doubt. I have not checked the source before, so I’m not acquainted with code and structure within. I checked out the github version. Seems there is a new ‘Private’ folder under Runtime AI Module, which is not present in the 4.7 preview or 4.6. Is the folder getting included as part of the 4.7 final version?

I’m sorry, I didn’t get what you meant there. So far, I’ve only copied the uproperty code from the two header files. Would I need to get Visual Studio for implementing the rest of the code?

The “version” builds do not contain cpp files which are usually put in the private folders. You just get the headers to be able to compile game-only code.

Yes, you’ll need full engine sources and VS to compile it. Maybe you can wait for this change to hit the promoted branch instead?

Alight, yea I’m currently running the movement logic outside the behavior trees. And as of now, nothing else in my project is dependent on whether it’s inside BT or not, as long as I have Reached Move Goal inside the BT. I’ll keep using it this way until the change is updated.