I'm trying to detect soldiers stance using camera to locate soldiers head which has different height for every stance.
_sensor = "EmptyDetector" CreateVehicle [0,0,0]
_callheight1 = {_sensor setpos [position _this Select 0, position _this Select 1, 0]; _result = position _sensor select 2; _result};
_callheight2 = {_sensor setpos [position _logic Select 0, position _logic Select 1, 0]; _result = position _sensor select 2; _result};
_absheight1 = abs(player call _callheight1)
_logic = "logic" createvehicle [(position _this select 0)+1,position _this select 1,0]
_absheight2 = abs(player call _callheight2)
_height = abs(_absheight2 - _absheight1)
_basepos = [(position _this select 0)+1,position _this select 1,_height]
deletevehicle _logic
deletevehicle _sensor
_cam = "Camera" CamCreate _basepos
_cam CameraEffect ["INTERNAL","BACK"]
_cam camsettarget _this
_cam camcommit 0
_cam2 = "Camera" CamCreate [0,0,0]
_camposnew = position _cam
_cam2 CamSetTarget _cam
_cam2 CamSetRelPos [0,(_camposnew select 2),0]
_cam2 CamCommit 0
~0.0000001
_cam2 CamSetRelPos [0,+500,0]
_cam2 CamCommit 0
_camtarget = position _cam2
_cam CameraEffect ["TERMINATE","BACK"]
CamDestroy _cam
CamDestroy _cam2
_status = _camtarget select 2
?_status > 400: _anim = "Stand"
?_status < 400: _anim = "Kneel"
?_status < 300: _anim = "Lying"
hint format ["%1\n\n%2\n\n%3",_status,_anim,_height]
exit
This script is based on old Jezuro's camera script and it's only prototype with some bugs. The most visible is blink after creating a camera where is the camera shown for a little while. I don't know how to get rid of it, so I need Your help.
Another bugs are on sloped terrain, but it can be later fixed using more cameras created in the same height as unit (using detecting ASL height).