This problem can be solved with Kenoli analysis (a pivotal technique in the science of StarCraft mapology).
From DatEdit:
The unit's boundaries, with locations being centered at 0,0 (the sign of the vertical axis should be reversed):
The horizontal dimension is easy, just a horizontal inverted location of size 11+11=22:
No matter how much the unit is horizontally displaced, even by one pixel, the Bring condition will return false.
The problem is the vertical dimension. A vertical inverted location of size 5+13=18:
The Bring condition returns true only when the unit moves exactly 4 pixels up, which is obviously not useful.
Let's try another location size 5+5=10. Bring returns true when there is no displacement, however there are false positives for slight displacements upward, so this alone is not reliable for pixel-accurate displacement detection:
The location does, however, detect displacement downward perfectly, and we can introduce a second vertical location 6+6=12 to account for upward displacement as so:
But with a displacement of exactly 13-5=8 pixels upward we find another false positive:
This can be accounted for by using the fact that when odd-sized locations are centered (all locations so far were even-sized), the larger half is placed on the positive end (negative end on the graph). Therefore we can eliminate this false positive by increasing the size of the first vertical location by 1:
This is good enough for just displacement detection, however utilizing more locations in this manner allows one to know how far a unit has been displaced, and is the basis for Kenoli's method for tracking unit coordinates.
Post has been edited 2 time(s), last time on Sep 20 2012, 9:05 pm by yoonkwun.
None.