Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
My trigger doesn't actually need a lot of custom scripts or an "Else" action because it only checks if DeezUnit is facing DatUnit. If DeezUnit is not facing DatUnit however,nothing will be triggered. So no "Else" action means less lines.
I'm sorry I'm a little confused, but simply calling the function as pOke did isn't going to do anything. You have to do either one of the suggestions I showed you
I'm sorry I'm a little confused, but simply calling the function as pOke did isn't going to do anything. You have to do either one of the suggestions I showed you
Since a unit might never perfectly face another unit a tolerance is needed. One can use the properties of cosine for this as it is symmetric around 0 degrees and aliases so simulates +/- tolerances well.
Say one wants to test that unit A is facing unit B within +/- X degrees...
First get the angle from A to B. Then subtract the facing of A from it. This gives an alias of the delta angle that B is at with respect to the current facing of A. The condition uses this delta angle to test if it is within the +/- angle tolerance of X. This is done by putting the delta angle through cosine and then checking if the result is greater than or equal to the cosine of X. If this test passes then B is within the specified tolerance of X from the facing of A.
(cosine((angle from A to B) - (facing of A))) greater than or equal to (cosine(X))
The (cosine(X)) term can be pre-computed as a constant for speed, hence only 1 cosine and 1 arctangent (2 parameter geometric version) are needed. In normal computing cosine is reasonably expensive to compute so a modular angle test is normally faster. This is the opposite with JASS (what GUI compiles to and WC3 runs) where the expense of cosine is masked by the JASS virtual machine overhead and is significantly less than emulating modular real. Hence this is the fastest approach for JASS, but probably is not in real programming languages.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.