I am currently creating a campaign that relies on stealth and stuff. So I tried to add a trigger to achieve that and I failed miserably. I wonder if this is possible?
You can easily get the angle between the positions of the attacker and the target using trigonometrics or maybe even pre-built functions and compare it to the target's facing angle.
Well, you have the functions Facing Angle of Unit and Angle between Points. If the target is directly in front of the caster, the angle from the target to the caster is exactly the opposite of the facing of the caster, or mathematically speaking, the difference between both angles will be 180 degrees. However, you probably want some defined vision angle, so in pseudo-code you would need something like:
I am currently creating a campaign that relies on stealth and stuff. So I tried to add a trigger to achieve that and I failed miserably. I wonder if this is possible?
Can some one point me in the right direction?
@lolzguy: Go
you probably need to be more specific.
It's possible to detect if a unit is in front of a unit.
You can easily get the angle between the positions of the attacker and the target using trigonometrics or maybe even pre-built functions and compare it to the target's facing angle.
@Enexy: Go
Ok Thanks
@Kueken531: Go
May you show an example of this? Sorry if I am bothering too much.
Well, you have the functions Facing Angle of Unit and Angle between Points. If the target is directly in front of the caster, the angle from the target to the caster is exactly the opposite of the facing of the caster, or mathematically speaking, the difference between both angles will be 180 degrees. However, you probably want some defined vision angle, so in pseudo-code you would need something like:
Thats basically it, you probably need an angle correction for negative or >360 angles.
i was bored so i made a test map for you..
Wow .... I feel so stupid (Facepalm) thanks guys :D
I created a trigger for this purpose which solves many of the problems associated with unit facing detection. Here's a link to the thread: http:www.sc2mapster.com/forums/development/triggers/21443-trigger-unit-behind-facing-unit/?post=23
And here's a link to a tutorial map I made:
Link Removed: http://www.mediafire.com/file/21as7gp5cxgd07o/Unit Facing Detection.SC2Map
Just in case you need more help on this issue.
:O Nice man, thanks. The title of the thread confused me a little :3