say you have poin1 and point2. how do i pick all units standing in the line of these points?
Easy with some maths.
their collision size must be upon the line.
Impossiable as far as I know unless you use a database system to allow you to return the collision redius of a unit as there is no native to do that.
Firstly you need to get the distance of the line.
d = SquareRoot((x1-x2)(x1-x2)+(y1-y2)(y1-y2))
Then get the mid point
xm = (x1+x2)/2
ym = (y1+y2)/2
Then enum all units within d/2 radius of the mid point (xm and ym).
This is the most efficent way to get the smallest possiable scoop of units which could lie on the line.
You then need to filter them out, even in the enum conditions to check if they are on the line.
For that algerthim, I would think you would have to check the perpindicular distance of the unit away from the line and if it is less than the collision radius, it is on the line.
This would require you to get the gradient of the line, calculate its position, repeate for the prepindicular line to intersect with it and then work out the point of intersection and then calculate the distance between the point of intersection and the unit.
This overall could be quite recource intensive unless you optimize it heavily so be warned.
Also the unit pick may not pick all the units on the line right at the edges of it or not work at all if the line is too short, but its accuracy should be fine for most of the length of the line ( 98+% of line length).