OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Gaia on 03 Aug 2006, 19:52:57
-
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).
-
_CAM camCommand "manual on"
_CAM camCommand "inertia off"
-
Hmm! That's a very clever idea, actually. ;D Maybe you can help The-Architect's problem with making a steaming-breath thing in conversation if you manage to make it work (same forum, a couple of posts below, can't be arsed with linking ;D).
I'd read through it or test it but I need to iron my shirt. Just wanted to say it sounds good.
/Wolfrug out.
-
Interesting indeed..
I also have played around with the cameras but I never got it to work in anyway..
Probably because I'm an idiot and complete math retard :P
If only you would make this into a function ;)
-
Hmm! That's a very clever idea, actually. ;D Maybe you can help The-Architect's problem with making a steaming-breath thing in conversation if you manage to make it work (same forum, a couple of posts below, can't be arsed with linking ;D).
I'd read through it or test it but I need to iron my shirt. Just wanted to say it sounds good.
/Wolfrug out.
http://www.ofpec.com/forum/index.php?topic=26301.0
:)
-
Any progress?
-
Any progress?
Yes, good question :D
This is a very promising script, please share anything new you have found out. :P
-
I'm trying to detect soldiers stance using camera to locate soldiers head which has different height for every stance.
No chance. There's no command you can place camera near unit's head. You will always get ground coords cause that's unit ingame position.
-
No chance. There's no command you can place camera near unit's head. You will always get ground coords cause that's unit ingame position.
Maybe, but camera always targets unit's head.
And no progress yet, I hadn't tried it since last post, because of not 100% work. Jezuro, maker of original script, tried it too, and he said there is no way to create that camera without visible delay.
-
Maybe, but camera always targets unit's head.
And what can you do with this direction ? you can't get 3d dir of the camera or caculate head position in another way.
script in the first postdoen't seem to be worky - it calculates everything but not what is needed. If you can get working algorithm I'm sure camera issue will be solved.
-
Maybe you should try the script yourself.
Works great for me. The blink is not as bad as you make it out to be. Maybe you could just do a little fade action to hide it.
-
Hmm... I get half of my words back :)
It does work - on flat surfaces only.
There're lots of unnesessary calculations in the script - that makes it difficult to understand. And I still can't see any clear ida behind it...
Anyway there's definately something to think about... I'm missing such command very much
-
Yeah. It has the same reliability problems every other method has, but does work..
-
but does work..
Yes, but how ? Can the very author explain what he is doing in this script ? Cause it's a set of command without clear sence for me at the moment :(
here is no way to create that camera without visible delay.
You set this delay in the script ;) You have to use camcommitted command - not pause if you don't want to see delay.
But without such delay it doesn't work for some strange reason.
So if you want help - explain your idea to the community first - cause it's hard to get it from the script :(
-
You may also want to try this script: http://www.ofpec.com/forum/index.php?topic=27992.0