Home   Help Search Login Register  

Author Topic: Getting the velocity of a unit  (Read 1043 times)

0 Members and 1 Guest are viewing this topic.

Lean Bear

  • Guest
Getting the velocity of a unit
« on: 03 Jan 2006, 15:57:33 »
Just checking to see if it is possible to get the velocity of a unit (not in a vehicle) and return it in the usual array format [x,y,z] ?

So far, I've only been able to get it to work on vehicles...

bored_onion

  • Guest
Re:Getting the velocity of a unit
« Reply #1 on: 03 Jan 2006, 16:00:44 »
it might be the same as setvelocity which will indeed only work for vehicles. couldnt be sure though.

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re:Getting the velocity of a unit
« Reply #2 on: 03 Jan 2006, 16:02:43 »
This :

Code: [Select]
Hint format ["%1", velocity player]
...works like a charm :).

marcus3

  • Guest
Re:Getting the velocity of a unit
« Reply #3 on: 03 Jan 2006, 18:11:47 »
i know u can get the velocty, but i dont think u can change it  :P

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Getting the velocity of a unit
« Reply #4 on: 03 Jan 2006, 20:01:03 »

Yes you can set velocity, but you have to do it locally
You cannot setvelocity a player unit, just objects

setvelocity [x,y,z]
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Lean Bear

  • Guest
Re:Getting the velocity of a unit
« Reply #5 on: 03 Jan 2006, 21:27:16 »
@ Terox

So you're saying that you can't change the velocity of the player? (Or similar soldier unit?)

marcus3

  • Guest
Re:Getting the velocity of a unit
« Reply #6 on: 04 Jan 2006, 02:57:10 »
i think u can, here, check this script out, it makes the unit 'Jump'
;      Script Copyright Rory Deutsch (Roni) May 2005 - rory@romad.com.au
;      Feel free to use, abuse or misuse as you see fit - just don't charge for it.

;      A script that allows a player to jump over low walls, onto roofs etc
;      Caution ! Jumping while sprinting may cause damage to player



;      Get jumper
_jumper = _this select 0

_startDamage = getDammage _jumper


;      If character is in the air or severely wounded then disable jump
? ((getPos _jumper) select 2) > 0.3 : exit
? _startDamage > 0.5 : exit





;      Place jumper off ground, give him a small upward velocity
_v = velocity _jumper

_vX = (_v select 0)
_vY = (_v select 1)
_vZ = (_v select 2) + 5

_jumper setPos [getPos _jumper select 0, getPos _jumper select 1, 0.3]
_jumper setVelocity [_vX, _vY, _vZ]


;      Move jumper to crouch position
_jumper playMove "CrouchToCombat"


;      If jumper injured while executing jump then force him prone
? getDammage _jumper > _startDamage : _jumper playMove "CrouchToLying"


hope thisa helps

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:Getting the velocity of a unit
« Reply #7 on: 04 Jan 2006, 04:27:16 »
Yep, as Marcus has pointed out, you can set the velocity of a unit, but you have to setpos it off the ground slightly before you do. I guess it sticks, or something ;)

Lean Bear

  • Guest
Re:Getting the velocity of a unit
« Reply #8 on: 04 Jan 2006, 12:22:31 »
Very strange, well, if it works.. :)

Thanks for your help guys!