• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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