• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Using Vexorian's model to change pitch

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I want to be able to move special effects and change their pitch. As I understand it, Vexorian made a dummy model (which I downloaded) that has many animations. I looked at the animations and they are in the form of "a" "b" "c" and so on. I need to know how to translate those into angles so that I can make the dummy unit, say face straight up (90-degrees) or straight down (270 degrees, or -90 degrees).

Is there a translation of his animations into degrees?

EDIT:

I should point out that I use GUI and do not know JASS.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,658
You should have taken a look inside the XE map of Vexorian which is the only official way to download the dummy... I just realized that that DUMMY.mdx that I gave you was also from Vexorian :D

Anyway, Vexorian did not implement full pitch rotation.
Because he made if for a missile system.
(However I can see that a missile could be moving backwards.)

Anyway this is how Vexorian made it:
JASS:
method operator zangle= takes real value returns nothing
    local integer i=R2I(value*bj_RADTODEG+90.5)
    set this.zang=value
    if(i>=180) then
        set i=179
    elseif(i<0) then
        set i=0
    endif
    
    call SetUnitAnimationByIndex(this.dummy, i  )
endmethod
Translated into a simple function it would be this:
JASS:
function SetUnitZAngle takes unit whichUnit, real angle returns nothing
    local integer i=R2I(value*bj_RADTODEG + 90.5)
    
    if i >= 180 then
        set i = 179
    elseif i < 0 then
        set i = 0
    endif
    
    call SetUnitAnimationByIndex(whichUnit, i)
endfunction

But as you could notice, if you set the angle to a point where the model would face backwards, this would not work.
That is why you can use this one instead to enable that.
JASS:
function SetUnitZAngle takes unit whichUnit, real angle returns nothing
    local integer i=R2I(value*bj_RADTODEG + 90.5)
    
    loop
        if i >= 180 then
            set i = 180 - (i-180)
            call SetUnitFacing(whichnit, 180 + GetUnitFacing(whichUnit))
        elseif i < 0 then
            set i = -i
            call SetUnitFacing(whichnit, 180 + GetUnitFacing(whichUnit))
        else
            exitwhen true
        endif
    endloop
    
    call SetUnitAnimationByIndex(whichUnit, i)
endfunction
 
Level 14
Joined
Aug 30, 2004
Messages
909
I hate to do this to you since you've been so helpful, but could you put some of that into GUI, or even spell out the logic and I can put it into code.

For example, what is: integer i=R2I(value*bj_RADTODEG + 90.5)

It looks like I convert the angle from degrees to radians, which I can do...but then what?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
That is actually the exact opposite way.
That makes a rounded integer of the arc...

That code sets the animation to a certain index. The animations are ordered so the first(0) will be 0 degrees and the 179th will be 179 degrees.
So you have very precise turn rate.

To call this you need a "Custom script: call SetUnitZAngle(udg_TempUnit, udg_TempReal)"
In this case it will set TempUnit's Z-facing to TempReal degrees.

I am not quite sure but I think you have to remove the (*bj_RADTODEG) part.
 
Status
Not open for further replies.
Top