@Pulciu I see, it’s a good idea to do that only when the transition occurs, it would actually be more precise and yield better results!
You should be able to do that with the Y curve from the first image I posted. If you create that curve for both feet, you can just compare those two values to check which foot is in front of the other.
For example, you could get the left foot curve and check if it’s higher than the right foot curve. If true, it means that the left foot is in front, and if false, means the right foot is in front. I believe that’s enough to achieve the results you want, but let me know if it doesn’t work!