Home   Help Search Login Register  

Author Topic: Detect stance  (Read 4225 times)

0 Members and 1 Guest are viewing this topic.

Offline Gaia

  • Members
  • *
  • Bohemia Interactive Senior Game Designer
    • My personal webpage (only in Czech)
Detect stance
« 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.

Code: [Select]
_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).

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Detect stance
« Reply #1 on: 03 Aug 2006, 23:28:14 »
_CAM camCommand "manual on"
_CAM camCommand "inertia off"
urp!

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Detect stance
« Reply #2 on: 04 Aug 2006, 17:12:19 »
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.
"When 900 years YOU reach, look as good you will not!"

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Detect stance
« Reply #3 on: 04 Aug 2006, 20:12:26 »
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 ;)
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detect stance
« Reply #4 on: 05 Aug 2006, 23:34:47 »
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

:)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Detect stance
« Reply #5 on: 15 Aug 2006, 23:10:25 »
Any progress?
urp!

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Detect stance
« Reply #6 on: 16 Aug 2006, 00:01:07 »
Any progress?

Yes, good question  :D

This is a very promising script, please share anything new you have found out. :P

Offline bdfy85

  • Contributing Member
  • **
Re: Detect stance
« Reply #7 on: 16 Aug 2006, 18:16:24 »
Quote
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.
Liberation Mod scripts&balance

Offline Gaia

  • Members
  • *
  • Bohemia Interactive Senior Game Designer
    • My personal webpage (only in Czech)
Re: Detect stance
« Reply #8 on: 18 Aug 2006, 12:32:27 »
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.

Offline bdfy85

  • Contributing Member
  • **
Re: Detect stance
« Reply #9 on: 18 Aug 2006, 16:11:35 »
Quote
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.
Liberation Mod scripts&balance

DanAK47

  • Guest
Re: Detect stance
« Reply #10 on: 19 Aug 2006, 19:30:41 »
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.

Offline bdfy85

  • Contributing Member
  • **
Re: Detect stance
« Reply #11 on: 19 Aug 2006, 22:32:08 »
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
Liberation Mod scripts&balance

DanAK47

  • Guest
Re: Detect stance
« Reply #12 on: 20 Aug 2006, 07:56:32 »
Yeah. It has the same reliability problems every other method has, but does work..

Offline bdfy85

  • Contributing Member
  • **
Re: Detect stance
« Reply #13 on: 20 Aug 2006, 10:36:51 »
Quote
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 :(
Quote
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 :(
Liberation Mod scripts&balance

Offline Cheetah

  • Former Staff
  • ****
Re: Detect stance
« Reply #14 on: 20 Aug 2006, 11:19:12 »
You may also want to try this script: http://www.ofpec.com/forum/index.php?topic=27992.0
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!