H DBR !
That's a fantastic idea ! :cheers:
At first I started thinking about the problems this approach would cause for things such as hit type event handlers, damage and healing and all the other stuff but then I hit on a similar idea that should work just as well or even better ! ;D
I have completed a number of scripts that allow the player to build a tent or a campfire. The problem is - the thing keeps appearing at some random point around him and not exactly on his position or in front of him as it should.
I tracked the problem to the old OFP clipping problem and I now create the object WAY in front of the player, so at least you'll know where it is and not have to search for it after building it
This made me think about your suggestion. How about this for an algorithm -
Make a function called checkHeight.sqf and have it take in the name of the unit being checked, whether a real name or a variable (eg rags or _player).
The function will do this -
Create a small object at the EXACT position of the target unit, but 2.5m above his head.
Check the EXACT position of the object - if it is EXACTLY the same as the target unit then keep looping REALLY FAST !
Lower the height of the object by (say) 0.05 metre.
Check again
Keep checking until the object is displaced by trying to occupy the same space as the target unit.
At that point if the object height is above (say) 1.5m then say that the target unit is "Standing", if it is above (say) 1m then say that he is "Crouching", othewise say that he is "Prone".
Delete imaginary object and exit script.That should do the trick ! It uses your idea of checking height of player without having to create a "zero damage" bullet addon or damage the player and heal him.
Of course I'd have to test it to work out the real limits for standing, crouching etc, but that SHOULD do the trick.
I'll try to draw this script up on the weekend and get back to the board with it if it works. (With full credit to you of course ! :cheers: )
Cheers !
Roni