I have a DistanceKeeper that moves to the left, it is a child of a static object. Currently I am calculating the distance between DistanceKeeper and it's parent in order to get the distance using this code:
distanceTraveled = Mathf.Abs(transform.position.x - parent.transform.position.x);
I am then displaying in a DFgui label, but the thing is, the number is not sequential.
For example, instead of going 1 2 3 4 5, it will output 1 3 5 9 13 20.
Is there another way to return the distance traveled in a updated and sequential way?
↧