- 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:
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
***
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
Yes the simplification holds true but the 2 lines of code given do not produce the same result.
- (Cos((Sector facing - (Angle from Loc1 to Loc2)))) Greater than or equal to 0.766
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)