Add wayPoint in onWayPointReach

I have got a two spatials. The first moves. The second one should be controlled by a MotionPath. When the second one reaches a wayPoint it should add the position of the first one to the path. But it there is no new wayPoint when it reaches a wayPoint.

My Code:
public void onWayPointReach(MotionEvent motionControl, int wayPointIndex) {

Now my question:
How can I add a wayPoint to MotionPath when onWayPointReach is called?


I found a solution.
My problem was that the next wayPoint was added when the last wayPoint was reached because I had only two wayPoints at the beginning. But MotionControl stops when the last wayPoint is reached.
My solution: I added another wayPoint between the first two wayPoints at the beginning and it works fine.