You can store the current position in a variable and compare it on next frame before updating the variable