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

Advanced pathing detection

Status
Not open for further replies.
I know there should be threads concerning this already, and i apologize for this, but i have been searching a while whithout results.

I'm doing a projectile system for my map, and i want a trigger to check for obstractles in the projectiles path.
To be simple:
Bullet hits wall (unwalkable) => bullet goes boom.

One way i thought of was to create a point every - lets say, 50 length units from the projectiles origin to its destination, and thereafter checking the pathing on that point using IsTerrainPathable. But this would clearly be very uneficcient, and also unprecise since the speed of the projectile might be pretty fast.

Is there any good way of solving this?
 
Level 2
Joined
Jan 20, 2009
Messages
17
there is no better way. however if u only count pathing (terrain), then its enough to check it every 64 distance.

my problem is even worse. i need to figure out the direction that a unit would go toward, when it tries to move to another location. this needs to calculate pathing and collision and must use the same algorithm of way finding than war3 itself (probably A*)
 
Level 8
Joined
Nov 9, 2008
Messages
502
This is something I'm using in my map to move a unit. Quite simple except I'm only moving things on the X axis. You would need to adapt it to calculate the new x and y as being the point ahead of your projectile's path. To find formula on curves (or a straight line in this case) on an x y go here: http://www.gap-system.org/~history/Curves/Curves.html

You can plug the formula you find there into google to learn how to use it or ask on yahoo like I did ^^ got a response in less than 10 mins (mind you I asked about parabolas).

Apparently using reals is faster.

JASS:
function Trig_move_Actions takes nothing returns nothing
    local unit u = gg_unit_Hpal_0000
    local real xu = GetUnitX(u)
    local real yu = GetUnitY(u)
    local real xp = xu - 4.8 //new x
    local real yp = yu //new y
        if ( IsTerrainPathable( xp, yp, PATHING_TYPE_WALKABILITY ) == false ) then
            call SetUnitX (u, xp)
        endif
    set u = null
endfunction
//===========================================================================
function InitTrig_MoveLeft takes nothing returns nothing
    set gg_trg_move = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_move, 0.02 )
    call TriggerAddAction( gg_trg_MoveLeft, function Trig_move_Actions )
endfunction

Vexorian made a function to check pathability using items somehow. Dunno why.
 
Last edited:
Status
Not open for further replies.
Top