PDA

View Full Version : Find Distance between 2 Units?

manstie
11-15-2009, 09:57 AM
Hi,

I need to be able to detect the distance between one unit and another.

Then If distance between 2 units is greater than 300.. etc...

Rep to whoever finds solution

reason 3
11-15-2009, 10:32 AM
Hi,

I need to be able to detect the distance between one unit and another.

Then If distance between 2 units is greater than 300.. etc...

Rep to whoever finds solution

Hmmm,how about doing something like this?Set to A a unit's position X,Y.
Then set to B another unit's position X,Y.

Then do something like A - B and find the difference between?

RoboHippo
11-15-2009, 10:40 AM
Use the "Math - Distance between points" function when entering the distance in GUI. It'll ask for two points, which you set to "Unit - position of unit" for each of the two units.

Please note that this would leak on its own, but could easily be fixed with some unit variables.

Have fun! :thumbs_up:

kkots
11-15-2009, 10:43 AM
There's a function:
Real Value - Math - Distance Between Points.

There's also angle between points. But you got to keep the order. If you do from one point to second point, then it will be some angle. If you do from second point to first point, then the angle will be different.

manstie
11-15-2009, 10:44 AM
Thanks RoboHippo.