The agent does not walk to the nearest valid point

Hello, I have a problem when trying to move an agent to a destination that is surrounded by a non-passable area,
the path is never computed and returns null. I need the agent to walk to the closest valid point to the destination.
How can I achieve this?

Example

when the path could not calculate I am using the property calculatePartial = true, this seems to work but not quite right, this way it traverse through the non-passable area

That’s odd. calculatePartial=true should be the solution. The only thing that does is to return the path to the closest node it found during the search. Do you have a screenshot?

Also, to clarify. This only happens when your nodes are blocked using a tag. If you make them completely unwalkable it will work even with calculatePartial=false.

Hello, here I have uploaded a demonstration video where you can see that the agent does not calculate the route when the destination is surrounded by a non-passable label.

what should I do? it is very important for me to solve this problem, thank you

Also consider incrementing A* Inspector → Settings → Max Nearest Node Distance to 1000, but not function…

I have the latest version (4.3.46) installed and it still doesn’t work

I have been doing tests and made the same example but instead of changing the tags, changing the walkable property (modifi walkability = true walkability value = false) of the node and in this way if it works correctly therefore the problem is when they are labels instead of non-walkable nodes, any ideas?

Hi

Could you confirm that your paths have calculatePartial=true?
If not, could you post the error message that the paths fail with? (set A* Inspector → Settings → Logging = Normal)

Hi Aron, I have done 2 tests:
1- calculatePartial = false: It does not find the path and does not show an error message with the option set A * Inspector → Settings → Logging = Normal.
2- calculatePartial = true: If it finds a route, but it is ignoring the labels that cannot be traversed.
Here I attach a video with the 2 tests.

if I set seeker.StartPointSnapping and seeker.EndPointSnapping in the center of the node (snap to node), it works fine with calculatepartial = true, but it makes a strange movement when I assign these 2 properties to it, the agent has like shaking or zig zag when walking I think which is due to the route calculation time since it seems that calculating partial = true consumes more resources.
I have 640 X 640 nodes with a size of 0.25

Hi

Sorry for the late reply.
You are completely right. That the path seemingly ignored tags when using calculatePartial and ClosestOnNode was a bug.
I have fixed it in my dev version now and the fix will be included in the next beta update.

Hello, could you tell me that you have modified? Besides that error you should modify the RaycastModifier since it also ignores the labels, I had to create a customRayCastModifier in which I changed the filter class:
class Filter
{
public Path path;
public readonly System.Func<GraphNode, bool> cachedDelegate;

public Filter()
{
    cachedDelegate = this.CanTraverse;
}

bool CanTraverse(GraphNode node)
{
    return path.CanTraverse(node) && path.tagPenalties[node.Tag] == 0; //Here code
}

}

Hi

A new beta version has been uploaded now.

I cannot make that change to the RaycastModifier because it’s not valid. Agents can traverse nodes for which the penalty is non-zero.