Support Forum

Preventing agents from going to edges near obstacles

Hey,

Is there any simple way to prevent an agent to be able to move to the edge of a node if that node is next to an obstacle?

Here’s a couple of examples:

GOOD:
Screenshot_1

BAD:
Screenshot_2

ALSO BAD:
Screenshot_3

When a behavior tree controls an agent’s AI, it always perfectly goes to the center of the node. However, when I manually control an agent, I am able to tell him to move to these odd locations.

I’m looking for the simplest solution possible. Is there any other way to do this other than with erosion?

Hi

Maybe what could work for you is to offset the whole graph by 0.5 nodes in both directions (change the center field on the grid graph by 0.5 times the node size). I think that will make the node boundaries line up with where you want them.

Hey - sorry for the delayed response.

I tried fiddling with the settings how you said but I don’t think I understand what I’m supposed to do.
Could you give me a more concrete example given my current settings? Here’s the screenshot:

Screenshot_1

I did more testing and just to clarify, what happens is that when an agent is told to move from a walkable tile onto a position that’s an obstacle, he’ll move as close as he can get but that means he’s clipping into the wall, and then he stops there, like so:

Screenshot_2 Screenshot_3