Download

Blueprint AI

I’m trying to get my AI to walk from its start position to a building. I originally set up my character using the Behaviour Tree tutorial on the documentation site. In the behaviour tree I have a “Does path exist” from self actor to my building, which returns false. I have it set up for my AI to wander around, and he’ll walk all the way around my building, but can not seem to have a path exist to that particular location. The map is just box brushes, and I even removed the building, and set its coordinates manually as the target location, but it refuses to go to that location. I’ve moved the building into different spots and its just not letting me go to the building.

It worked in an earlier build, but I dont know whats going on now.

Using engine 4.4.3

Picture of building with the navmesh… Not sure what that tearing in the mesh is about either.
NavMesh1.jpg

This is just a guess, but it could be because the navmesh doesn’t actually exist at the building (only around the building) and when you get the building’s location, you are getting the location of the root which is in the middle of the building.

Thats what I had thought too. I grabbed the location of the building, set it manually as the blackboard key, and then removed the building. It still wouldnt go there. It was doing some wierd stuff with that location for a while, I moved the building up out of the mesh, and it was getting stuck where the building was.

I just manually punched the coordinates again, tried that spot and it worked, was going to the location, moved the building back in place and its not going to the location.

So if thats the issue, how do I get it to build the navmesh properly?

Ok, I was looking thru the details for the static mesh root of my building, down under collision theres a checkbox for “can ever affect navigation”, I unchecked that. Now the AI will walk to my base.

But now he cant walk back to his home location (as per the behaviour tree tutorial) and I’m not sure why. it does the wait task, tries the moveto: homelocation, and fails, loops back to the wait.

Technically it is built properly since you cannot walk through the building, however I recall that in the expanded collision settings for blueprint components there is an option to disable affecting the navmesh. I don’t think this is a good way though because in other cases your characters will think there is a straight path through the building and will get stuck on the building when they try to walk through it.

What might work is to get the buildings location, convert it from world to local space using ‘inverse transform location’, offset this location by just over half the building width so that it is within the navmesh by adding a vector (half width, 0, 0), convert back to world space using ‘transform location’ and then rotate this location around the building to face you by using ‘rotate vector’, to get the rotator use the original building location and ‘find look at rotation’ with your bot as the target.

There are other systematic approaches you can take depending on how your game is setup. For example you might be able to setup the buildings blueprint is such a way that the collision box isn’t the root, you could probably have a box with no collision be the root and place it in front of the buildings door so that the root location is always in the navmesh.