Forum rules - please read before posting.

To Stop/Pause/Interrupt NPC's current pathfinding in Unity Navigation

Hi,

When my NPC moves to another point with pathfinding, I'd like to interrupt it and I would like that if my NPC would stop and don't finish his way/pathfinding to the point, just stop where he is.

Do you have something solution for it?ű

Thank you very much in advance!

Comments

  • edited May 2019

    If your character is moving along a pre-defined Path, you can add cutscenes or pauses to each point along it.

    When the Path is not pre-defined (i.e. the character is pathfinding), you cannot. However, it's feasible that through scripting, you could hook into a custom event to perform something similar.

    I can see about adding such a feature, but I will need to know more about your situation and needs.

    Can you share an image to illustrate? What is the intention behind stopping them at some point along a path? Please share as much detail as you can.

  • Thank you Chris for your fast reply!

    I use not pre-defined Path, so the NPC is pathfinding. I'd like that, when I push a button, the npc stops. After I push same button, npc will plan his pathfinding again and start it again. I use more point (marker), so the system will choose random one of them and navigate the npc to there. After I can push that button again and npc stop again....and etc....

    The button and random generate method is fine already. What is missing, I should interrupt forever the NPC's path, when he is on the path.

    Unfortunately, I can't coding, but I think I have good logic skills, so I think 2-3 code line of a script should solve this problem, if I can add "interrupt move on "found" path" after when I pushed the button.

    I hope I could wrote it clear.:)

  • What is missing, I should interrupt forever the NPC's path, when he is on the path.

    Right, but at what point do you want to stop him from moving? The Character: Move along path Action can have its Method set to Stop Moving, and this will make them stop completely when run.

    Through code, this is a case of calling the character's EndPath() method.

    If you want to end their path when they reach a particular node along that path, you will be able to do so in the next update - as it will provide a new OnCharacterReachNode custom event, which gets triggered when a character reaches each point along their path.

  • Yes I use these in other situation thank you:) , but now I use Character: Move to Point. And I would like to interrupt moving to the point. Can you suggest something for it?:)

  • The Character: Move along path Action, set to Stop Moving, will interrupt a character's motion along a path, even if that path was generated by the Character: Move to point Action.

  • Yes, some days ago I've tried this, but no success, my character stop until 1 second and after continue the path. But now I put an "Actionlist: Kill" node after Stop Moving action, and it works!:)

    Thank you for your time Chris!:))

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!