0

I have a GKAgent2D component attached to my GKEntity, is there any baked in way of finding out when the GKEntity has began and ended following the GKPath assigned to it in the GKGoal(toFollowPath:…) goal?

I need to despawn my sprite once it reaches the end of the path.

Adam Carter
  • 4,741
  • 5
  • 42
  • 103
  • I should note, currently I’m implementing this by checking whether the node of the entity intersects with the last point in the path on the update cycle – Adam Carter Mar 29 '16 at 16:07
  • Couldn't you just look at the velocity variable of the GKAgent2D? In theory if it is moving it has started or currently working its way to the destination and if it isn't moving it has finished or hasn't started. – Skyler Lauren Mar 29 '16 at 21:44
  • @SkylerLauren I can’t help but find your comment a little patronising, which is especially surprising as it is wrong. The entities circle around the end node of the path, causing their velocity to be non-zero. – Adam Carter Mar 30 '16 at 00:59
  • I apologize for coming off "patronising" as it was not my intention at all. I asked a question and said "in theory" as in I really don't know. This is why I asked it in comment instead of posting an answer. Also unfortunately I do not know enough about what you have done to understand "The entities circle around the end node of the path, causing their velocity to be non-zero." that either. Again my apologies for coming off wrong, my intentions are only to help. – Skyler Lauren Mar 30 '16 at 01:07

0 Answers0