- A* version: 5.3.3
- Unity version: 6000.0.36f1
In a somewhat rare case, I need to use GridGraph for patfinding on a continuous world. To make paths seem more natural, I use a modified version of FunnelModifier, which in turn uses GridStringPulling. To make matters more complicated, I need to support non-point agents. So, the first question:
- How hard would it be to add an agentRadius parameter to FunnelModifier to make it generate points not at corner of obstacles, but with an offset, so that agents wouldn’t clip corners when moving alon the calculated path? As far as I understand, the problem is very complicated in a general case. My case is simpler - agentRadius is always <= 0.5*cellSize, so at worst the path should go through the center of the cell.
For now, I apply additional post-processing that tries to move corner points away from, well, corners. It’s a super-complicated set of crutches and work-arounds for corner cases, which grows more complicated every day (for example, handling “thin walls” is its own special kind of pain). It’s complicated further by the fact that GridStringPulling sometimes (often) produces points which, when queried for nearest node, return the node that contains the obstacle. This is understandable: a corner point really “belongs” to all four cells around it, so it’s not unexpected that, when queried, the graph might return any one of them. However, this makes my task very, very hard, because I need to calculate the direction of offset away from the corner, and if the point is inside the obstacle, the algorithm will choose the wrong direction, inside obstacle. Mind you, I use the term “obstacle” loosely here, because it might be a walkable cell, which just doesn’t have a direct connection to other cells in path. This happens near “thin walls”, and especially bad near “balconies” where two adjacent walkable nodes might have a great different in height. I can’t use Area ID check to weed this case out, since they often belong to different parts of the same area. Which leads me to
- Can GridStringPulling be modified to at least return a point that is guaranteed to be inside a cell that “belongs” to path?
I’ve been banging my head against this problem for past several months. But maybe I need a completely different approach? In that case, any advice would be welcome, too.