A* Pathfinding Project

Stop the current route?


#1

Good evening,Can anyone suggest me a clean way to stop the current route to a clicked point?
Example: I click a point on the plane (point B) and my Player (point A) starts running to point B.
I would like that, if between point A and point B, my Player uses a spell, it stops after launching my spell, but in the current situation, after doing the spell animation, it resumes to run towards Point B.
I tried to insert an event in the Idle animation that moves the target (of the Targetmover) in the current transform.position of the Player, but I had poor results.
Does anyone have any better ideas? Thank you


#2

Hi

In the current version this is unfortunately not possible directly. You can the target to the AI’s current position, however as you have found out it can be quite tricky to set it to the precise point were the character will end up. Or you can use the ai.isStopped property, but once that is set to false the character will continue along its existing path.
In the next version (I think) it will be possible to call ai.SetPath(null) to clear the current path completely.