I am making a trigger which makes a projectile rotate around a unit where ever it moves.
I am using the locus of circle formula cause i need to to rotate around a specific radius.
But my problem is its not perfect you can check the map
Is there any more effective way to do this?
I am using the locus of circle formula cause i need to to rotate around a specific radius.
But my problem is its not perfect you can check the map
JASS:
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
local real h
local real k
local real x1
local real y1
local real x2
set h = GetLocationX(GetUnitLoc(udg_hero))
set k = GetLocationY(GetUnitLoc(udg_hero))
if (udg_x1 > 300) then
set udg_con=1
endif
if (udg_x1 < -300) then
set udg_con = -1
endif
if (udg_con == 1) then
set udg_x1=udg_x1-5
endif
if (udg_con == -1) then
set udg_x1=udg_x1+5
endif
set y1 = ((SquareRoot(90000-(udg_x1*udg_x1))))
if (udg_con == -1) then
set y1 = (y1-(2*y1))
endif
call SetUnitPositionLoc( udg_proj, OffsetLocation(GetUnitLoc(udg_hero), udg_x1, y1) )
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_003, 0.01 )
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
Is there any more effective way to do this?