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

Line of Sight

Status
Not open for further replies.
Level 40
Joined
Dec 14, 2005
Messages
10,532
Acos(Cos(A-B)), where A and B are in radians, will return the angle between them (again in radians).

Therefore (the example uses 90 degrees each way, for a total of 180 degrees),

JASS:
globals
    unit tempUnit //for passing to the enum
    group enumGrp = CreateGroup() //global groups rock
endglobals

function SimpleWindowEnumFilter takes nothing returns boolean
    return Acos(Cos(GetUnitFacing(tempUnit)*bj_DEGTORAD-Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(tempUnit),GetUnitX(GetFilterUnit()) - GetUnitX(tempUnit)))) <= bj_PI/2
endfunction

function SimpleWindowEnum takes nothing returns nothing
    set tempUnit = //your unit
    call GroupEnumUnitsInRange(enumGrp,GetUnitX(tempUnit),GetUnitY(tempUnit),<enum range>,Filter(function SomeWindowEnumFilter))
endfunction
 
Level 14
Joined
Dec 9, 2006
Messages
1,091
Acos(Cos(A-B)), where A and B are in radians, will return the angle between them (again in radians).

Therefore (the example uses 90 degrees each way, for a total of 180 degrees),

JASS:
globals
    unit tempUnit //for passing to the enum
    group enumGrp = CreateGroup() //global groups rock
endglobals

function SimpleWindowEnumFilter takes nothing returns boolean
    return Acos(Cos(GetUnitFacing(tempUnit)*bj_DEGTORAD-Atan2(GetUnitY(GetFilterUnit()) - GetUnitY(tempUnit),GetUnitX(GetFilterUnit()) - GetUnitX(tempUnit)))) <= bj_PI/2
endfunction

function SimpleWindowEnum takes nothing returns nothing
    set tempUnit = //your unit
    call GroupEnumUnitsInRange(enumGrp,GetUnitX(tempUnit),GetUnitY(tempUnit),<enum range>,Filter(function SomeWindowEnumFilter))
endfunction

Alright, though it is in Jass, (And I have no idea to do it) I can read up on it. So, there is no way to detect Line Of Sight through GUI?

~Asomath
 
Status
Not open for further replies.
Top