| 05-20-2008, 03:07 AM | #1 |
A unit is located at the center of a circle C that has a radius R. The unit casts a spell that generates a Lightning Effect from C to a point p that is at a distance R from C. The position of p varies with time t such that p completes one revolution about C every t seconds. Essentially, the idea here is to have the ray deal damage to units as it sweeps over them. I'm very comfortable with the algebra involved with setting up the ray and the rotation of p about C, but I'm stumped as to how to calculate when the ray is sweeping over a unit. I'd prefer if there was a way to do this in GUI. Thank you for your time. EDIT: Would it be possible for me to set up a number n of points across the ray such that the sum of the diameters formed by the circles equals the length R in order to locate units in the ray's breadth with a distance from point function? |
| 05-20-2008, 03:17 AM | #2 |
Well, first this is in the wrong area; you want triggers and scripts. Second, you're going to want to do this in JASS. GUI algebra/calculations/etc. are atrocious, especially when you're getting this complicated. |
| 05-20-2008, 06:40 AM | #3 |
Basically you're going to project some points to either side of P and to either side of C along a new line that is perpendicular to the line from C to P. At that point you end up with a very long, thin rectangular approximation and you use something like GroupEnumUnitsInQuad. Basically, that means JASS. |
| 05-20-2008, 11:32 AM | #4 |
That's what I was thinking of recommending (using GroupEnumUnitsInQuad and just moving it along), but I wasn't sure. |
| 05-20-2008, 11:59 AM | #5 |
Like a pie chart. |
| 05-20-2008, 04:51 PM | #6 |
The atan2 function will let you get the angle from your caster to a potential target. If that angle is between [current ray angle] and [next ray angle], then the unit was hit. Keep in mind that angle 0 is east, pi/2 (90 degrees) is north, and 0 is 'between' 7pi/4 (316 degrees) and pi/4 (45 degrees) if you're angle is increasing. You should also do the work in radians. |
| 05-20-2008, 10:35 PM | #7 | |
Quote:
That GroupEnumUnitsInQuad function is slower than hell and not suitable for periodic use. Try this one. http://www.wc3campaigns.net/pastebin...e83fb8ff6e8443 |
| 05-21-2008, 03:12 AM | #8 |
I would've linked yours but it was posted in the pastebin when you last showed it to me and I couldn't find a link to it :P |
