Hello, when using SetPath() by script, is there a way to ask the character to go to the first node by pathfinding?
Otherwise, if I use MoveToPoint() before SetPath(), how do I do a wait til finish option in MoveToPoint() by script so that SetPath() will only execute after the character is close to the path first node?
Thanks.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
If you were doing this with Actions, you could queue up a Character: Move to point Action followed by a Character: Move along path. If you mapped the fields to parameters, you could set the parameter values through script and run it from there.
Through script only, you could try tackling it with a coroutine to wait for the player to finish moving to the first position, but you'd be best off incorporating the dynamic path to the first path, and the pre-set nodes of a second path, into the player's actual motion.
Thanks for the tips. Just to share my finding: as my MoveToPoint() is also in the coroutine, I used these codes to achieve the desired effect:
while (thisNPC.IsMovingAlongPath ())
{
yield return new WaitForFixedUpdate ();
}
thisNPC.SetPath();