Ok, I think I'm starting to understand your overall approach. I assume handle_movement() is called every frame? And I assume you have somewhere else in your code a function that moves your player entity by the distance stored in the dist vector?

If that is the case I don't recommend using a wait inside the handle_movement function. If dist.z = 0 takes effect depends on the order of the functions in the internal scheduler.

Could you please try to exactly write down which part of the code's behaviour you want to change?


Always learn from history, to be sure you make the same mistakes again...