2d AI does not stop moving even when path recalculated

Hello!

So, the problem is that i have a ship design and i implemented some doors. (Thanks to your previous advice :D). Everything works great, i implemented AILerp script for movement with some bezier curve to make it a bit more natural.

gg uses a four way movement.
i recalculate the path each 0.5 seconds so there is PLENTY of time to recalculate it before npc reaches the door in my example.

So what happens? possible bug but maybe i just have to add something to the lerp script :smiley:

I have two doors (one above one below). I close the top door and tell the AI to start moving from far right to far left. He has path like on the picture.
Then in middle of movement i close the doors with SetConnectionInternal (and it works cause he can’t go back or past it in any direction once closed, tried first closing and then selecting so he goes past and it won’t calculate path for him)

So once the doors are closed, aprox 0.5s later he recalculates the path and it disappears (the path from scene view) but he still continues all the way to the goal and ignores the blocked pathway (takes him like 2-3 more seconds to even get to the doors) (tho the path technically does not exist anymore)

I have attached components that are on the AI aswell. I have an option to send some signal to the player to recalculate the path. I suppose i can cancel the path somehow and give him new information? (this is why i suspect it might be a bug as player should be automatically stopped once he realises the path doesn’t exist anymore)

Thank you once again!


image

just wanted to show the other two images, you can clearly see here that he doesn’t see the path anymore but he just ignores that and goes all the way to goal even tho the doors are slammed shut :smiley:

Hi

This has been fixed in beta version 4.3.28.

The AIPath script will now clear the path it is following if a path calculation fails. Previously it would continue following its previous path. This could lead to problems if the world had changed so that there was no longer a valid path to the target. The agent could then in some situations just continue trying to walk through obstacles instead of stopping. In pretty much all cases this change in behavior is what you want and will not cause any problems when upgrading.

1 Like

awesome :smiley: i thought i have the latest version as i started recently will be sure to check up on it! thank you a lot for both the awesome asset and super fast responses