• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Translating 46 degrees into this formula

Status
Not open for further replies.
Level 12
Joined
May 16, 2020
Messages
660
Hi guys,

I'm using the explanation from here (below the trigger) to identify a secondary target that is within a facing angle of a primary target.

@Dr Super Good wrote that one should rather use this formula:

It should be
  • (Cos((Sector facing - (Angle from Loc1 to Loc2)))) Greater than or equal to 0.766
Yes the simplification holds true but the 2 lines of code given do not produce the same result.

Can someone who understands how to calculate angles in WC3 explain what "0.766" in degrees is please?
I want the "angle of sector origin" to be 46 degrees. What value is the equivalent of this with the formula above?
(and can I somehow calculate this in Excel for next time?)

Cheers

***
Anyway, here's how to pick units within circular sector
  • Set Loc1 = <Circle origin point>
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 600.00 (<Circle radius>) of Loc1 matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)) and do (Actions)
    • Loop - Actions
      • Set Loc2 = (Position of (Picked unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Acos((Cos((<Circular sector facing> - (Angle from Loc1 to Loc2)))))) Less than or equal to <40.00> - half of the angle at sector origin
        • Then - Actions
          • //Put actions for units within sector here
        • Else - Actions
      • Custom script: call RemoveLocation(udg_Loc2)
  • Custom script: call RemoveLocation(udg_Loc1)


attachment.php
 
Status
Not open for further replies.
Top