I have an issue where once the first 0 is found ( in the stop distance curve) it instantly plays the last frame of the stop animation which as seen in the video looks really bad. I am using a C++ function to binary search the value from the distance curve and give the time of it. I have also added a case when the last middle and first searches are 0 to interpolate slowly to the time of the final frame but that did not work either what could be the solution.