|
-
How can I get the distance btween two MCs?
-
first get the distance between their _x's, then the distance between their _y's. this can be used to draw a right triangle in which the hypotenuse is the line between the two mcs. using some elementary trig/geometry, we know that the square of the hyp. is equal to the sum of the squares of the two sides, so...
dx=mc1._x-mc2._x;
dy=mc1._y-mc2._y;
dist=Math.sqrt(dx*dx+dy*dy);
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|