HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Effect Help

02-12-2009, 01:51 AM#1
Eznce
I'm just starting to dwell more into JASS and i've been messing around with some scripts from wc3jass but i cant seem to figure them out. I am trying to make a unit circle another unit at an appropriate speed/distance. I tried using UnitCircleUnit script, but i can't figure out Handles yet, so i dont know. I am just wondering another way to do this.
02-12-2009, 03:27 AM#2
Blackroot
Handles are any thing which extends a handle... Things that extend handle: everything EXCEPT reals, integers, and strings.

Just pass two units as the handle values; otherwise I'm not entirely sure what this script is.

to do this yourself; keep reading:

P1 is always r units away from Po. To do this; simply set the value of P1x = Pox + r*cos(angle) and P1y = Poy + r*sin(angle)
In this

In this case: P1 = Rotating unit's x/y
Po = Caster unit.
r = Radius of the circle.

To get the angle between two points; you know the formula is:

Atan2(yo-y1, xo-x1)

That's really all you need to do. The math behind it is really quite simple trig; if you know the ratio formed by your line you can multiply it by the radius to get the curvature. And you know cos is the relation of angular X to r based on angle and sin is the relation of angular Y to r based on angle. The reason this creates a circle is because after 2Pi rotations you've completed a full circle across both sin and cos. (Actually in this case; the value is -Pi to Pi because of the nature of Atan)

Hope that explains it? - If not I posted code that will do it; hopefully it brings things together.

[edit]

Looking over this I explained it poorly so here's some code:

Expand JASS:
02-13-2009, 12:29 AM#3
Eznce
thanks Blackroot