wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 04-28-2009, 09:49 PM   #1
marshall
User
 
Join Date: Aug 2003
Posts: 104

marshall has little to show at this moment (1)

Question Spiralling in - gone haywire

I have a black hole-type spell and want units to spiral into it.
I have the following code
Collapse 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 09:52 PM.
marshall is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-29-2009, 09:10 AM   #2
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

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 Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














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.
Pyrogasm is offline   Reply With Quote
Old 04-30-2009, 01:07 PM   #3
marshall
User
 
Join Date: Aug 2003
Posts: 104

marshall has little to show at this moment (1)

Default

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 01:07 PM.
marshall is offline   Reply With Quote
Old 05-01-2009, 07:30 AM   #4
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,514

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

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 Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














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.
Pyrogasm is offline   Reply With Quote
Old 05-01-2009, 08:22 AM   #5
grim001
requires vJass
 
grim001's Avatar


Code Moderator
 
Join Date: Nov 2006
Posts: 1,540

Submissions (10)

grim001 is just really nice (277)grim001 is just really nice (277)

Send a message via AIM to grim001
Default

If you post a demo map it would be much easier to fix.
grim001 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:15 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2014, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services