Displacement is a vector. Distance is line integral of absolute value of displacement.
It is possible to have zero displacement (back to original point) but the distance traveled is not zero.
For 2D case if you wan to calculate distance traveled=d.
define coordinate x,y and xs,ys (xs=x,ys=y, initially).
set d=0 at initialize page.
Assume evolution page is
At constraint page add the following lines:
Then, d is the distance traveled in 2D plane.