This problem needs major solving.
One idea is to use a 'latent' function (i.e. script), camcreate a smoke grenade (or something) and pass it briefly over the unit at a specific height, then return you a global variable, true or false based on whether the object hit the unit (standing up) or not (lying down).
Pros - It works (much of the time).
Cons- Not reliable
- It doesn't work if the unit is faliing (units tend to fall upside down)
- It doesn't work if the unit it on a very steep incline (can hit the unit's head or legs, or the ground)
- It sometimes fails if the unit is running (level or non-level terrain)
- It is latent, so it doesn't instantly return you a value. Consequently you have to take this into account in a script
Another method is (getpos this select 2) < 0.0135 or whatever it is, which you mentioned in your post.
Pros - It occaisionally works!
Cons- It is very unreliable
- Only works on inclines
- The 0.0135 value changes
Someone mentioned a while ago using a 'fired' evenhandler, comparing the height of fired ammo to the unit's height. The returned value is quite reliable, only you have to wait until the unit shoots (or force it to shoot), which would make it a VERY latent function (unpredictably so), would interfere with the scenario that the script was working in, and would make it dependent on whether the unit had ammo, was reloading etc.