• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Missile System with New Special Effects

Status
Not open for further replies.
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.
 
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.
 
Level 13
Joined
May 10, 2009
Messages
868
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.
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.

JASS:
// 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.
 

Attachments

  • Euler Angles.w3x
    20.6 KB · Views: 34
Last edited:
Level 12
Joined
Mar 24, 2011
Messages
1,082
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
 
Level 14
Joined
Jan 16, 2009
Messages
716
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.

JASS:
    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:
Status
Not open for further replies.
Top