Hi all! I’m having some trouble with getting the coordinates from the previous frame of one of my shapes. What I have going on right now is a project that uses blob tracking to interact with ofxBox2d shapes/joints. I’m trying to get the previous position of the smoothedPoint variable I’m tracking in order to check when the point is moving (using the solution from this thread: https://forum.openframeworks.cc/t/storing-mouse-position/14303) and to use to check the object’s velocity (which I am unsure of if I’m doing that right).

Below is the code. The middle of it is dealing with Kinect/Box2d stuff. In the beginning of the update function I have a conditional statement to check if the mouse is moving, and at the end of it, I’m 1) checking to see if the mouse is moving, and if it is, setting it to false, and 2) setting the prev position to the current position. The formatted code is below:

Instead of comparing the points exactly (which is not recommended for various reasons), I’d subtract the current position from the last position, which will give you a “velocity” vector. Then take the magnitude of that vector … then check and see if that velocity magnitude is greater than some threshold.

Yep. The velocity gives you a direction, but you don’t care about the direction. You just want the scalar magnitude so it doesn’t matter which direction it’s going in, just that it’s moving above a certain speed.