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

[MATH] - How do I check if a point is behind a unit

Status
Not open for further replies.
Level 8
Joined
Feb 3, 2013
Messages
277
How do you find a way to check if a given point is behind a unit's current facing?

1hze6w.png

So in this example, the formula would detect that all the points labeled with UPPERCASE LETTERS are behind the unit, and all the points labeled with lowercase letters are infront of the unit.
 
This is one way to do it:
  • Set Point = (your point)
  • Set Point2 = (Position of Unit)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Abs(((Facing of Unit) - (180.00 + (Angle from Point to Point2))))) Less than 90.00
    • Then - Actions
      • -------- Front --------
    • Else - Actions
      • -------- Behind --------
  • Custom script: call RemoveLocation(udg_Point)
  • Custom script: call RemoveLocation(udg_Point2)
 
Status
Not open for further replies.
Top