I'm using libgdx Follow Path Steering Behavior in my top-down game. When unit reaches the end of the path, it goes to the start (not directly, but following path), then to the end and so on. How to stop following path, when unit reached the end point?
2 Answers
Try FollowPath#setArriveEnabled(boolean)
. It allows you to set whether or not to use Arrive behavior to approach the end of an open path.
Additionally, you might want to take a look at FollowPath#setArrivalTolerance(float)
-
\$\begingroup\$ Using Arrive has no effect, also with high ArrivalTolerance. \$\endgroup\$ Commented Oct 17, 2015 at 9:32
-
\$\begingroup\$ experimenting with different parameters made Arrive work. But there is another problem (maybe because of predictionTime), my steering object stops in some distance to target. How can I fix it? \$\endgroup\$ Commented Oct 17, 2015 at 12:46
When unit reaches to the end point then you can simply reset the position of the unit as previous what it was and then continue like in this manner or you can simply destroy the path after you done with it if possible.
I don't know about your platform but the concepts are same for any platform.So if my answer is helpful then please vote. ;)