Forum rules - please read before posting.

ResumeLastPath () limitation?

Hello. I have an NPC following a preset path, but when it detects a player by raycast, it will chase the player position by MoveToPoint. But when the player leaves the raycast, it will call ResumeLastPath ().

Most of the time it can return to the preset path. But sometimes when it follows the player to too far, it cannot return to the preset path. May I ask is this related to the path generated by MoveToPoint (I am not using PathFinding this time)? Or is it due to the distance it is away from the preset path?

Comments

  • Is there a way to record the node and direction / previous node the character is traveling in, then set it back after chasing the player?
  • ResumeLastPath assumes that the character is idle - and just resumes going wherever it was when last moving.  If you have the character move mid-way along, that will become its new new "last path".

    The Char script does include a SetPath method that accepts the next/previous nodes, so I will look into adding a function that returns the next node on the current path - so you can store that temporarily before calling SetPath when the NPC is to return to their old Path.
  • Thanks in advance!
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.