the farther away actor 2 is, the faster actor actor 1 accels - HOW?
scitunes
Member, Sous Chef Posts: 4,047
Would I accomplish this using magnitude or something? How do you use that?
Comments
Magnitude, in this case, is the distance between two points - a line segment.
It is used like this:
DistanceBetweenActors = magnitude(abs(Actor1.X-Actor2.X),abs(Actor1.Y-Actor2.Y))
Magnitude is a distance, and as such, always needs to be positive. That's why the abs() methods are in there as well.
That formula will give you the distance, in pixels, between the two actors. It will increase as the distance increases.
Joe
d= Square root of ( (x2-x1)^2+(y2-y1)^2)
When you square the results of the subtraction, wouldn't it automatically make any negative number positive anyway? Is this automatically incorporated into "magnitude" or is it necessary to specify the absolute value?
-Caleb