I have a problem where the following happens:
- AI is given a target that it can’t navigate to.
- AI progresses along the path to the impossible target and without intervention would correctly get as close as it can.
- Logic running in parallel is trying to find an alternative target for the AI to go to and this is evaluated each frame.
- Most frames the alternative target is found and is near the original target.
- Occasionally the AI cuts across an unnavigable node for a frame whether on the path to the original or alternative target.
- Testing for an alternative destination then fails in all cases because the test being done involves using IsPathPossible passing in the nodes for the current AI location and the target locations. The current AI location node is unwalkable because of the corner cutting thus failing the check.
Initially I thought it was because of Simple Smooth cutting the corner but it happens with no smoothing. Looking at the implementation of IsPathPossible it appears that i might be able to disregard the start nodes walkable state however this seems like a hack.
An another option would be to always test the alternative destination from the original start point and not the current AI location and i know that the original start point is always walkable. However, this isn’t quite the real test as the environment can be modified around the AI as it navigates.
Is there a suggested solution for this?
I hope this is enough to go on as it appears to be a more general concept than a specific bug. I can provide an image if need be.