Hit Box Prevents AI Navigation to Goal Location

I’m working on a town management game where NPCS walk to resources nodes, trees rocks, etc and attack them for resources. Problem. The only way I can get my AI to navigate to the nodes is to completely shut off all “Can affect navigation” This allows AI to walk to the spot, but now they bash into walls rocks and trees because it’s not affecting the navigation anymore.

I changed the navtype to Dynamic obstacle but they still walk straight into everything.

You need to check (and show us) the resulting navmesh generated in both cases. (press P)

Make sure the start and end points for each request are on that navmesh otherwise it won’t work.

How do I make it so the AI can get as close to the tree as possible. And don’t have to turn off the affect navigation, because the AI will just bump into trees when walking if I turn it off.

You could probably just raise the acceptable radius on the moveto command. Like if your trees have a 50cm radius and moveto is sending them to tree’s absolute world loc, up the acceptance radius to 60 or 100, and incrementally dial it down if they’re stopping too far away.

Alternatively, you could add an arrow component or something to your resource actors, mark it as hiden in-game and place it at the relative/local location you want NPCs to harvest from. Then in your behavior tree or state tree task where you set the move to location, get the arrow component from the resource actor and use its world location for the moveto. This will give you more control to line up the mining/chopping animations too.

I use something like this is my game for furniture to line up animations with the meshes. If you don’t have a traditional player pawn, you could also try the Smart Object system.

Forests are hard to navigate. Imagine that the NavMesh shows where the center of your actor can be. The hole seems bigger than the tree because it is the size of the tree + the size of the actor.

My suggestion would be to just make the trees not affect the NavMesh. The actors will bump into the trees because of the collision but will path right through them. You’ll have to make sure however, that trees always have enough space between them to squeeze a character otherwise you might have characters stuck.