Angle Comparison Issue

Danis[h]

New Member
Reaction score
19
Angle Comparison Issue [RESOLVED]

Solved

Okay, so basically what I'm trying to do is this: I want the game to detect whether or not a rotating unit is facing towards a unit in passing when it runs by..

Basically, the players have to follow a path, and if the "sentry" (in this case a banshee) they run past is facing towards the spot they're running by, I want the game to react.. yet I can't seem to get the angle comparison right.

This is what I've got so far.
Trigger:
  • Banshee one
    • Events
      • Unit - A unit enters Banshee 1 <gen>
      • Unit - A unit enters Banshee 2 <gen>
    • Conditions
    • Actions
      • For each (Integer A) from 1 to NumBanshee, do (Actions)
        • Loop - Actions
          • Set TmpPoint[5] = (Position of (Triggering unit))
          • Set TmpPoint[6] = (Position of Banshee[(Integer A)])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TmpPoint[5] and TmpPoint[6]) Less than or equal to 350.00
              • (Facing of Banshee[(Integer A)]) Less than or equal to ((Angle from TmpPoint[5] to TmpPoint[6]) + 20.00)
              • (Facing of Banshee[(Integer A)]) Greater than or equal to ((Angle from TmpPoint[5] to TmpPoint[6]) - 20.00)
            • Then - Actions
              • Game - Display to (All players) the text: Works
            • Else - Actions


Trying to compare the angle between the two points (position of unit entering region, to position of senty (banshee) and then the facing of the banshee.

NOTE: I am going to remove the locations, once I've got this working.

Update: I'm assuming it calculates the angle in relation to the x-axis which would explain why the above comparison wasn't working. Now I just don't know how to make the comparison
 
the angle from 5-6 is different than the angle from 6-5

Yea, I wanted it to work if the angle was in-between those two values.
So lets say that angle 1 is 40
then if angle two is in-between 20 to 60, it should work.

if this is not what you meant, could you please specify it more clearly? I'm a bit at a loss on this issue.
 
problem with angles is 350 + 20 = 10 which may be part of it

my question is you want it to say Works if the Banshee is facing triggering unit or facing the opposite direction?
 
problem with angles is 350 + 20 = 10 which may be part of it

my question is you want it to say Works if the Banshee is facing triggering unit or facing the opposite direction?

I want for it to work only when the banshee is facing towards the triggering unit.
 
Trigger:
  • * Set TmpPoint[5] = (Position of (Triggering unit))
    • * Set TmpPoint[6] = (Position of Banshee[(Integer A)])


should read

Trigger:
  • * Set TmpPoint[6] = (Position of (Triggering unit))
    • * Set TmpPoint[5] = (Position of Banshee[(Integer A)])
 
Trigger:
  • * Set TmpPoint[5] = (Position of (Triggering unit))
    • * Set TmpPoint[6] = (Position of Banshee[(Integer A)])


should read

Trigger:
  • * Set TmpPoint[6] = (Position of (Triggering unit))
    • * Set TmpPoint[5] = (Position of Banshee[(Integer A)])

didnt seen to work. Does anyone else have any suggestions?... The angle the banshee is facing is not fixed, it changes all the time.

update:
Okay so here is an attempt at a visualization of the issue. I am assuming that warcraft III calculates a facing angle, and the angle between two points relative to the x-axis. This assumption is made because warcraft 3

So assuming I have two points “A” and “B.” Point A is the point of my triggering unit and B is the position of the banshee. The angle between these two points I’ll name “u”
Now I have a second angle, which will be the facing angle of the banshee. This angle I’ll name “v”.
angle.jpg

Now from this image, the facing angle of the banshee at B is definitely not pointed towards A. What I need now though is a way to see whether or not v is pointed in the general direction of the position A.
I’m trying to do this by comparing the two angles, but I’m stuck on the issue.
 
General chit-chat
Help Users
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top