Home   Help Search Login Register  

Author Topic: Helicopter ground manoeuvering  (Read 1620 times)

0 Members and 1 Guest are viewing this topic.

camden_guitarist

  • Guest
Helicopter ground manoeuvering
« on: 27 Nov 2005, 16:08:13 »
Cheers people,

I'm looking for a way to make helicopter with wheels drive around with a limited speed on the ground, handy for parking it in a hanger or drive it in between trees to camoflage it. Anybody an idea how to do this?

Paul.

Offline oyman

  • Members
  • *
  • king of pings
Re:Helicopter ground manoeuvering
« Reply #1 on: 28 Nov 2005, 03:55:51 »
I remember that DKM's mi28 could do this, do a search for thier mi28 at ofp.info and you should be able to find it ;)

camden_guitarist

  • Guest
Re:Helicopter ground manoeuvering
« Reply #2 on: 30 Nov 2005, 11:26:33 »
Did that already, couldn't quite figure it out, how it was done, plus their mod is like sorta protected, can't extract a config.cpp...anyway, I'm not looking to copy and paste but just for the basics...all that stuff in the MI28 is very specific to that mod, you can't use it anyway.

Cheers,


Paul

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:Helicopter ground manoeuvering
« Reply #3 on: 04 Dec 2005, 01:53:26 »
email sombody in the mod and ask them how they did it.

Kyle Sarnik

  • Guest
Re:Helicopter ground manoeuvering
« Reply #4 on: 06 Dec 2005, 00:49:38 »
I have something just for you. I created it for my apache pack a while back, it allows you to taxi the helicopter like you would drive a jeep, but you may need to add some animations to your model for it to work, and you will definatly have to edit it so it works for your helicopter. Also there is support for rotating wheels there too, thats the FWhls anim, and also an animated rear wheel (which is actualy needed for the script to work, if your chopper doesn't need an actual animation, make it an invisible animation. It also has to be executed via an engine eventhandler:

Code: [Select]
_helo = _this select 0
_speed = 0
_vx = 0
_vy = 0
_vz = 0
_maxF = 0.75599
_maxR = -0.45599
_maxD = 1
_maxDn = 0
_coef = 0
_maxFR = 15
_maxRR = -9

? driver _helo != player : exit

#camCreate
_CAM = "camera" camCreate [0,0,0]
_CAM camCommand "manual on"
_CAM camCommand "inertia off"

#loop
? driver _helo != player : goto "exit"
?! (isengineon _helo) : goto "exit"
? (getpos _helo select 2) > 0.3 : goto "hold"
?!(alive _CAM) : goto "camCreate"

_CAM camSetDir 0
_vx = velocity _CAM select 0
_vy = velocity _CAM select 1
_vz = velocity _CAM select 2

? _vz < 0 : goto "center"
? _vx > 0 : goto "right"
? _vx < 0 : goto "left"
? _vy > 0 : goto "increase"
? _vy < 0 : goto "decrease"
? _speed >= 0.05 : _speed = _speed - 0.05
? _speed <= 0: _speed = _speed +0.05
goto "loop"


#increase
? _speed < _maxF : _speed = _speed + 0.05
goto "move"

#decrease
? _speed > _maxR : _speed = _speed - 0.05
goto "move"

#right
_phase = (_helo animationphase "RGear")
? _phase <= (_maxD - 0.05) : _phase =_phase + 0.05
_helo animate ["RGear",_phase]
? _vy > 0 : goto "increase"
? _vy < 0 : goto "decrease"
goto "loop"

#left
_phase = (_helo animationphase "RGear")
? _phase >= (_maxDn + 0.05) : _phase =_phase - 0.05
_helo animate ["RGear",_phase]
? _vy > 0 : goto "increase"
? _vy < 0 : goto "decrease"
goto "loop"

#center
_helo animate ["RGear",0.5]
@ (_helo animationphase "RGear") == 0.5
goto "loop"

#move
_CAM setvelocity [0,0,0]
_CAM camSetDir 0
_coef = _speed
_pos = (velocity _helo)
_dir = (getdir _helo)
? speed _helo <= _maxFR && speed _helo >= _maxRR : _helo setvelocity [(_pos Select 0)+(sin _dir)*_coef,(_pos Select 1)+(cos _dir)*_coef,velocity _helo select 2]
_whlphase = (_helo animationphase "FWhls")
? _whlphase <= 0 : _whlphase = 0.9999
? _whlphase >= 1 : _whlphase = 0.0001
? _speed == 0 : goto "loop"
_whlphase = _whlphase + (speed _helo/250)
_helo animate ["FWhls",_whlphase]
~0.1
goto "loop"

#hold
? (getpos _helo select 2) <= 0.3 : goto "loop"
goto "hold"

#exit
camdestroy _CAM
exit

And the config for the animations (they should be the same for the script to function properly):

Code: [Select]
      class Animations
      {
         class RGear
         {
            type="rotation";
            animPeriod=2;
            selection="RGear";
            axis="axis_RGear";
            angle0=-0.23;
            angle1=0.23;
         };
         class FWhls
         {
            type="rotation";
            animPeriod=0.00001;
            selection="FWhls";
            axis="axis_FWhls";
            angle0=0;
            angle1=6.2831853072;
         };
      };
« Last Edit: 06 Dec 2005, 00:54:20 by Kyle Sarnik »