How do i lock the flying height of a flying unit to a constant value?
In my case there is a projectile rotating around a unit. I want that projectile to have the same height as the unit and not go down and rise up when there are cliffs. How do i do that?
I tried setting the Flying height of the projectile to same z value of the unit around which it rotates but, it doesn't work...
here udg_rot = rotating projectle
udg_rotor = unit around which it rotates.
In my case there is a projectile rotating around a unit. I want that projectile to have the same height as the unit and not go down and rise up when there are cliffs. How do i do that?
I tried setting the Flying height of the projectile to same z value of the unit around which it rotates but, it doesn't work...
here udg_rot = rotating projectle
udg_rotor = unit around which it rotates.
JASS:
function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
local location loc = GetUnitLoc(udg_rotor)
local real z = GetLocationZ(loc)
local real x1 = (CosBJ(udg_angle)*200)
local real y1 = (SinBJ(udg_angle)*200)
local real x2 = GetLocationX(GetUnitLoc(udg_rotor))
local real y2 = GetLocationY(GetUnitLoc(udg_rotor))
call SetUnitFlyHeight(udg_rot, z, 999)
call SetUnitX(udg_rot, (x2-x1))
call SetUnitY(udg_rot, (y2-y1))
set udg_angle = ( udg_angle + 10.00 )
if ( udg_angle >= 360.00 ) then
set udg_angle = ( udg_angle - 360.00 )
endif
call RemoveLocation(loc)
set loc = null
call RemoveLocation(loc)
set loc = null
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_002_Copy takes nothing returns nothing
set gg_trg_Untitled_Trigger_002_Copy = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_002_Copy, 0.05)
call TriggerAddAction( gg_trg_Untitled_Trigger_002_Copy, function Trig_Untitled_Trigger_002_Actions )
endfunction