1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Missile System with New Special Effects

Discussion in 'Warcraft Discussion' started by aple, May 10, 2018.

  1. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    I'm curious. Has anyone tried this, yet?
     
  2. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,335
    Resources:
    17
    Tools:
    2
    Maps:
    2
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    17
    I tried but failed with yaw, pitch and roll.
    Without that values the missile will not face the current momentum, therefore the result will be quite crappy.

    Did read some stuff about it and did some simple tests but somehow it was just wierd, so I stopped it.
    If one changes only roll, one manipulates kinda "facing" of the effect (like for units), but as soon one changes another value it becomes totaly wierd. Actually that is already wierd cause according to informations I found, yaw should be "facing".
    It seems that yaw pitch and roll expect values in radians.
     
  3. aple

    aple

    Joined:
    May 20, 2009
    Messages:
    807
    Resources:
    2
    Maps:
    1
    Tutorials:
    1
    Resources:
    2
    All those new ways to control SFX and no way to control Yaw, Pitch, and Roll? Weird.
     
  4. BloodSoul

    BloodSoul

    Joined:
    May 10, 2009
    Messages:
    759
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Despite what Tasyen said, there's the extraordinary Gimbal Lock problem that we need to take into account.

    I faced that problem when I tried to make an arrow face a helper effect. If the arrow attempts to look too much towards the sky or the ground, it rotates in a strange manner.
     
  5. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,335
    Resources:
    17
    Tools:
    2
    Maps:
    2
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    17
    Did you use set pitch roll & yaw,
    or did you use set oriantation (all at once).
    I observered that setPitch flips the facing (forward, backwards) of the effect if it jumps over ~1.6, ~4.8 which can produce quite wierd results, arrows looking in 2 directions if you fastly bounce over that values.
    SetOriantation does not have this behaviour.
     
  6. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    I managed to make one.
    It was quite a pain to make it rotate right because the rotations are on the global axis and not on the local axis of the model.
    I need to find the time to release it.
     
  7. BloodSoul

    BloodSoul

    Joined:
    May 10, 2009
    Messages:
    759
    Resources:
    2
    Spells:
    2
    Resources:
    2
    Well, both ways gave me the same results. Pitch is limited, raging from -180 to 0 (in radians, ofc). I noticed if you assign other values to it, the orientation is displayed in a glitchy way as you said.
    EDIT: I haven't properly tested pitch with "BlzSetSpecialEffectOrientation" function, so this part might be misleading. Ignore what I just said for now.

    The formula I used is probably wrong, resulting in that weird behavior seen above. However, I've read on different forums that Euler Angles are limited regardless of the formula being used, and that quaternions is what overcome that issue.

    Currently, the orientation is being calculated based on the effect's facing angle (or angle between points), the distance, and difference between heights (slope?). In the end, I'm using
    -Cos(angle) * slope
    for Pitch, and
    Sin(angle) * slope
    for Yaw.

    Code (vJASS):

    // Function shamelessly extracted from wurst math lib
    // Credits to BlinkyBoy, I guess?
    function SlopeAngle takes real z1, real z2, real dist returns real
        return Atan2(z2 - z1, dist)
    endfunction

    function SetEffectAngle takes effect whichEffect, real angle, real slope returns nothing
        // Yaw, Pitch, Roll
        call BlzSetSpecialEffectOrientation(whichEffect, Sin(angle) * slope, -Cos(angle) * slope, angle)
    endfunction
     

    call SetEffectAngle(whichEffect, angle, SlopeAngle(whichEffects_Height, anotherHeight, distance))



    Here's the map, but it's a mess.
     

    Attached Files:

    Last edited: May 11, 2018
  8. nedio95

    nedio95

    Joined:
    Mar 24, 2011
    Messages:
    1,055
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Wouldn't it gimbal lock with euler angles ? People usually use matrices or quaternions for a reason...

    Also, as I remember, it should be: Yall, Pitch, Roll, in that particular order. Any other order would mess it up.

    Not particularly helpful but well...
    Regards
    -Ned
     
  9. Wareditor

    Wareditor

    Joined:
    Jan 16, 2009
    Messages:
    681
    Resources:
    3
    Maps:
    3
    Resources:
    3
    This should work when x and y are not equal to 0 but it should be fairly easy to implement a solution for those cases. There is probably a more optimized way of doing what I am doing here.
    I will do so when I have the time to work on the system again.

    Code (vJASS):

        struct MissileVector3
            real x
            real y
            real z
         
            //yaw
            //zero safety in case of y==0 or (y==0 and x==0)
            method operator angleX takes nothing returns real
                local real ix = RAbsBJ(this.x)
                local real iy = RAbsBJ(this.y)
                return Atan(this.z/this.y)*(1-(ix/(ix+iy)))
            endmethod

            //pitch
            //zero safety in case of x==0 or (x==0 and y==0)
            method operator angleY takes nothing returns real
                local real ix = RAbsBJ(this.x)
                local real iy = RAbsBJ(this.y)
                return -Atan(this.z/this.x)*(1-(iy/(ix+iy)))//the - is not a mistake
            endmethod
         
            //roll
            method operator angleZ takes nothing returns real
                return Atan2(this.y,this.x)
            endmethod
        endstruct
     
     
    Last edited: May 13, 2018