Quick version of the question:
Is it possible to hook up a modifier (like a funnel) to a MultiTargetPath in advance so that it is handled inside its pathing thread?
Longer Explanation:
We have a very extensive AI system that senses key environment information in order to make smarter decisions when it is time to plan. We have our own nodes for cover and combat positions and each time the unit “senses,” we want a path to be calculated to all possible candidates within some detection range. This much is actually working fairly well, however, the issue has to do with the type of paths that are generated.
In order to accomplish our goal, we simply setup all the candidate node positions and start a MultiTargetPath. This is done independent of the unit’s seeker (which is being used for their actual movement), so we do it using the following:
var p = Pathfinding.MultiTargetPath.Construct(m_agent.CachedTransform.position,
positions, null,
HndOnPathComplete);
AstarPath.StartPath§;
This works very well since all the pathing is done in the Astar thread, however, none of the paths are modified in the thread. So we are getting the bare bones jagged paths when the callback is invoked. This means in order to get a better path, we have to stall the main thread to individually process each one using a funnel modifier inside the completion callback.
Is it possible to hook up a modifier (like a funnel) to a MultiTargetPath in advance so that it is handled inside its pathing thread? I couldn’t seem to track down how I might be able to go about this if it’s possible.
If this isn’t possible and you know any other ways we might be able to accomplish this task, please let me know.
Thanks!