Hey, I've been trying to figure out how to make a unit move in a wave-like pattern.. like
p1_.-'¨'-._´´´´´_.-'¨'-._p2
_________'-._.-'
And if I remember from my math lessons, offset*Cos(Amplitude*Duration) and offset*Sin(Amplitude*Duration) where Amplitude is the span from up and down and duration is how many degrees (1-360)
but I don't know how to add this to a coordinate system, and then rotate it. I tried something like this
Where counter is a counter going from 1-360 -1-360 until it reaches the target. But this only works at a 0-90 degree angle.
Anyone done this before? Any suggestions?
I'd look it up in my 'blue book' (where almost all important functions are listed) but I can't seem to find it...
EDIT: hmm, maybe the 'Duration' is the 'distance' between the two points
EDIT: right, sorry, forgot to convert to radians (pi/180.0), my calculator has two modes, radian and degrees, so I don't have to add it myself
EDIT: still working on it, the solution is often very silly, but I sure as hell can't see it. Let me know if you know... or something
p1_.-'¨'-._´´´´´_.-'¨'-._p2
_________'-._.-'
And if I remember from my math lessons, offset*Cos(Amplitude*Duration) and offset*Sin(Amplitude*Duration) where Amplitude is the span from up and down and duration is how many degrees (1-360)
but I don't know how to add this to a coordinate system, and then rotate it. I tried something like this
JASS:
local real x = GetUnitX(spawn)+10*Cos(facing*bj_DEGTORAD)+Cos(5*counter*bj_DEGTORAD)
local real y = GetUnitY(spawn)+10*Sin(facing*bj_DEGTORAD)+Cos(5*counter*bj_DEGTORAD)
Anyone done this before? Any suggestions?
I'd look it up in my 'blue book' (where almost all important functions are listed) but I can't seem to find it...
EDIT: hmm, maybe the 'Duration' is the 'distance' between the two points
EDIT: right, sorry, forgot to convert to radians (pi/180.0), my calculator has two modes, radian and degrees, so I don't have to add it myself
EDIT: still working on it, the solution is often very silly, but I sure as hell can't see it. Let me know if you know... or something
Last edited: