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.
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
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
- If - Conditions
- Loop - Actions
- For each (Integer A) from 1 to NumBanshee, do (Actions)
- Events
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