In my game I have AI units dodge enemy attacks by moving tangent to the attacker. I do this by setting IAstarAI.destination, which has the expected problem that due to the time it takes pathfinding to complete the enemy still ends up getting hit a good part of the time; especially as more units are involved in combat.
Sometimes the AI only dodges a short distance, sometimes it moves farther, such as backing out of range which could be 5 meters.
I’m using CharacterController on each AI.
Ideally I’d like to set IAstarAI.destination, immediately start moving towards the destination, and when the path calculation completes to find the nearest point on the path and continue from there without jitter.
Would it work to call IAStarAI.SetPath() as soon as I know to dodge, with only the current and end node? Followed by SearchPath()? If so, should I be using ABPath.Construct?
I could call IAStarAI.Move() - however I don’t think that will preserve momentum or use acceleration. I want the unit to move as if they naturally had the path, rather than as if they were on a conveyor belt.