• 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.

A Basic rotation

Status
Not open for further replies.
Level 7
Joined
Aug 19, 2009
Messages
278
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

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?
 

Attachments

  • rot1.w3x
    17.4 KB · Views: 38
Status
Not open for further replies.
Top