Add wayPoint in onWayPointReach

Hi,
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) {
motionControl.getPath().addWayPoint(target.getWorldTranslation());
}

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

Thanks!

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.