Get nearest node with unwalkable tags

Hi Aron,

Is it possible yet to get the nearest node to an area surrounded by tags (not unwalkable nodes, but just tags)? For example, I wall off an area completely and set the tags on those nodes to tag = 5. I set on a unit that tag 5 is invalid (i.e. unwalkable in tag speak).

Currently if I try to use the GetNearestNode function…it returns the closest node inside the tagged off area. But it should not. It should get the neareast walkable node outside of the tagged off area correct? But it doesn’t.

Is this possible in your current version?

walkable / unwalkable are only setup during scan

Yes, but I’m setting nodes during runtime with the graphupdate scene component and other code as well. So during my game, a player can “wall off” an area with castle walls. So no units can traverse inside the walled off area. But I want some units to be able to traverse this area, and others to not be able to – during runtime.

you can add a raycast to your movement script. if it hits the wall and unit type , create a new path for that unit ( perhaps stopping it in front of the wall)


So you are saying that you have a region which does not have a tag, but which is surrounded by for example a solid wall of nodes which do have a tag. If you request the closest node in the middle of that region it will definitely just report the closest node in the region, because those nodes are valid as they do not have the tag.

If you want to find a path to the closest point this is a bit more tricky because with tags it cannot immediately find the closest node that it can reach. However you can set the ABPath.calculatePartial flag to true on your path instance, that will allow it to return the best path that it could find instead of marking the path as failed because it didn’t reach the target.