Recently I posted a question related to adding progressive changes to a driver output value once per action of the user, directly on the viewport and independently of the fps of the scene. Fortunately a user named Leander found a solution. Here's the question and answer: While loop Drivers and additive movement
I was trying to understand the logic behind Leander's solution, and he said that by using a Custom Property it would "keep track" of the drivers previous value.
I found this behavior interesting and very useful, because if we can have an empty that copies the location of another object but also "lags behind" while in movement, we could then find the direction and velocity the cube's motion (main object) by checking the positional difference between its last location and it's new, all of this directly on the viewport without scripts.
By simply adapting Leander's file, I managed to kinda make it work, as you can see on the Blend file attached. Press play and check how the bone points towards the direction of movement of the cube, and once the movement stops the empty catches up with the cube (and the bone points up). You can also disable the animation and grab/move the cube around to see it in action.
The problems are two:
1-since apparently Custom Properties are restricted to a 0-1 limit, once you move the cube farther than x=1 or y=1 the empty stops following.
2-the empty follows extremely close, making diagonal movements unstable, janky and the empty quickly trying to snap to X or Y axis instead of going diagonally.
Is there any way to expand the system to greater than x and y=1, and there's any way to delay the empty even more behind so that the direction and distance of the movement can be more accurately and reliably determined?
PS: I know about the "Slow Parent" option on Relations Extras. Creating a second empty slow-parented to the main Empty, and making the bone follow this new empty, makes the motion less janky indeed, but not only it doesn't solve the limitation of the motion restricted to 0-1, it also is not a reliable source for measuring distance, as it keeps moving to reach the final position even after the cube has stopped, depending on the Offset parameter of the slow parent option.