Wc3C.net Spiralling in - gone haywire
 Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar

 04-28-2009, 08:49 PM #1 marshall User   Join Date: Aug 2003 Posts: 104 Spiralling in - gone haywire I have a black hole-type spell and want units to spiral into it. I have the following code JASS:```set radius = dissipate * 384.00 set tarx = GetUnitX(uA) set tary = GetUnitY(uA) set dx = tarx - x set dy = tary - y set dist = SquareRoot(dx * dx + dy * dy) set mult = dissipate + ((radius - dist) / radius) //at epicenter we will be twice as fast set dist = dist - (mult * 1.92) set rAngleChange = mult * 0.0314159265 //1.8 degrees means 2 seconds for 1 orbit at outer edge set angle = Atan2(dy, dx) - rAngleChange set tarx = x + (dist * Cos(angle)) set tary = y + (dist * Sin(angle))``` "dissipate" is a value intended to decrease the power of the movement and can be in the range 0.000 to 1.000. For the majority of the effect it is set to 1.000. x and y are the coords of the black hole uA is a unit that is spiralling in and can never be further than radius away from x,y The above code runs every 0.01 seconds. The intention is that the closer the unit gets to the center, the faster they are pulled in and the faster they spiral around. Something above is wrong, because either they are moving phenomenally fast or they are flipping 180 degrees on every iteration. I'm hoping some trigonometry genius can tell me where my case of arsebrain lies? Last edited by marshall : 04-28-2009 at 08:52 PM.
04-29-2009, 08:10 AM   #2
Pyrogasm

Respected User

Join Date: Sep 2006
Posts: 4,520

Submissions (9)

It all seems alright to me. The only thing is that I think Warcraft might have an issue with negative angles, so that could be screwing with things. However, it's not likely that that's the case, so...
__________________
Quote:
 Originally posted by Rising_Dusk Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request ThreadDone for, unless someone else wants to revive it...
It lasted a damn long time.

Quote:
 Originally posted by Kyrbi0 Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
 Originally posted by Pyrogasm Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.

 04-30-2009, 12:07 PM #3 marshall User   Join Date: Aug 2003 Posts: 104 My understanding is that negative angles are only an issue for things like unit facings - they shouldn't affect the raw mathsy calculations above? I've double checked the code above and can't for the life of me figure out why my victims are out of control. They do gradually get closer to the center, but the amount they are spinning around by is huge. Last edited by marshall : 04-30-2009 at 12:07 PM.
05-01-2009, 06:30 AM   #4
Pyrogasm

Respected User

Join Date: Sep 2006
Posts: 4,520

Submissions (9)

Recode it from the ground up, then. There could be some weird error you've got that shouldn't be there.
__________________
Quote:
 Originally posted by Rising_Dusk Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request ThreadDone for, unless someone else wants to revive it...
It lasted a damn long time.

Quote:
 Originally posted by Kyrbi0 Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
 Originally posted by Pyrogasm Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.

 05-01-2009, 07:22 AM #5 grim001 requires vJass   Code Moderator   Join Date: Nov 2006 Posts: 1,540 Submissions (10) If you post a demo map it would be much easier to fix.