Measure the distance covered by an actor. Is there a simple way?
MarkOnTheIron
Member Posts: 1,447
Hi everybody,
I was wandering if there was a way to measure the distance covered by an actor.
Magnitude can't help because the actor doesn't move in a straight line.
Time/Velocity can't help because the actor doesn't move in a fixed velocity.
Is there any other way?
I was wandering if there was a way to measure the distance covered by an actor.
Magnitude can't help because the actor doesn't move in a straight line.
Time/Velocity can't help because the actor doesn't move in a fixed velocity.
Is there any other way?
Comments
and since it is not a straight line ... attributes to store startY and endY...
basically interpret the differences of those attributes as two sides of a triangle:
the difference in the Xs will give you the base of a triangle;
and the difference in the Ys the vertical side...
the other side...the hypotenuse... is the distance traveled.
find the the sum of squares of those 2 sides ... ((x*x)+(y*y)) and then function sqrt of that sum. that will give you the distance...
and, even I know there has to be a better way!... but I don't do the math!
MH
EDIT: thinking again, just get the magnitudes of X and of Y and square each and sum them and then sqrt will = distance.
and, if you are moving with curves... you may have to just do a pixel count...