Jump to content
Sign in to follow this  
newiy

Moving in a circle

Recommended Posts

I wrote a small script that would cause units to "orbit" a desired object (it works with moving units too, but not very well tounge_o.gif ), but I have two problems with it...

1) I'm not sure how to modify the delay I put in the script so the unit would move continuously (for faster units) and without distorting the circle too much (for slower units)...

I tried the good ol' t = d/s but it only made it worse.

2) The unit will just stand still when the radius of the circle is small. (Ingame limitation?)

Here's the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_Performer = _this select 0

_Radius = _this select 1

_Ascension = _this select 2

_Reference = _this select 3

_t = 0

_deg = 0

_Point = "logic" createVehicle (getPos _Performer)

#PerformLoop

?(!Alive _Performer) : goto "End"

;change this delay?

~1

_t = _t + (pi / 12)

_deg = _t * (180 / pi)

_r = _radius

_Relx = _r * (cos _deg)

_Rely = _r * (sin _deg)

_Obsx = _Relx + ((getPos _Reference) select 0)

_Obsy = _Rely + ((getPos _Reference) select 1)

;Doesn't seem to work :(

_Obsz = ((getPos _Performer) select 2) + _Ascension

_NewPos = [_Obsx, _Obsy, _Obsz]

_Point setPos _NewPos

_Performer doMove _NewPos

goto "Performloop"

#End

deleteVehicle _Point

exit

Actually I have something to confess... the only reason I wrote this script was so I could watch units move according to my favourite graphs in polar coordinates... I'm strange like that.

Thanks in advance for any help I might receive.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×