MotionControlListener not reporting when reaching WayPoints correctly

Hey all! I’m trying to make a Cinematic that includes a spatial moving along a path and my camera moving along a different path (a sort of pinch maneuver where the two just get closer to each other).

I have the motion working correctly, but I need to do other things when certain waypoints are reached, and for some reason the waypoints reached are really… inconsistent. I have 5 WayPoints on a MotionPath, and when I do a simple println to see when the WayPoints are being reached, I get something like this:

//I'll comment what the Kotlin code is doing in case it's unclear
val camPath = MotionPath() //create new MotionPath instance
val startingPoint = //set a variable of type Vector3f to the cameraNode's starting location
camPath.addWayPoint(startingPoint) //adding waypoints
camPath.addWayPoint(startingPoint.add(0f, .5f, 0f))
camPath.addWayPoint(startingPoint.add(0f, 1f, 0f))
camPath.addWayPoint(startingPoint.add(0f, 1.5f, 0f))
camPath.addWayPoint(startingPoint.add(0f, 2f, 0f))
//this just creates an abstract object of a listener that contains one function
camPath.addListener { motionControl, wayPointIndex ->
    when (wayPointIndex) { //just a basic switchcase in Kotlin
        1 -> println("Reached $wayPointIndex")
        2 -> println("Reached $wayPointIndex")
        3 -> println("Reached $wayPointIndex")
        4 -> println("Reached $wayPointIndex")
        else -> println("something went very wrong :(")

My animation plays very smoothly, and for the right duration. Just when I try to see when I reach a certain WayPoint, I get outputs of… very inconsistent results.

First run:

Reached 2
Reached 4
Finished Animation!

Second run:

Reached 3
Reached 4
Finished Animation!

Third run:

Reached 1
Reached 4
Finished Animation!


The only thing that I could think of that would be interfering with the MotionEventListener is maybe something with the tpf of my application’s SimpleUpdate function? Some interference with the FPS? I’m very unfamiliar with how the Render Loop functions, so I might have missed something very basic here. Do I need to do something to the MotionEvent duration to get it to sync with the Render Loop properly or something?

I am running this Cinematic within a custom AppState for my app that I enable when something gains a focus (think zooming in on an object and blurring the background), so I’m not sure if that messes with the animation timing.

Any help would be greatly appreciated! Thanks!