Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

How to increment the number by 1's to get distance traveled?

$
0
0
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?

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>