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

Picking units in a cone

Status
Not open for further replies.
Level 22
Joined
Nov 14, 2008
Messages
3,256
Simple math question, when you enum how do you make it enum in a cone?

Or else if you check if the enumed units are inside a cone from x&y coords towards angle v?

In JASS please if possible else GUI is fine or a formula that takes coord x,y,angle and length
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
make a line through your start point towards your angle
make another line through your unit which is perpendicular on the first line
check the distance r between the unit and the intersection point of the 2 lines
this distance r should depend on the distance d between the start point and the intersection point

one made a similar filter function to check if a unit is standing on a line through x/y and x2/y2
in the end it was a single line of code after I simplified it a little bit :)
 

Attachments

  • cone.png
    cone.png
    13.8 KB · Views: 105
Status
Not open for further replies.
Top