Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: Helo's Direction on landing?  (Read 3683 times)

0 Members and 1 Guest are viewing this topic.

Offline Bingoz

  • Members
  • *
Helo's Direction on landing?
« on: 09 Feb 2011, 23:46:02 »
Helo's Direction on landing?

are there any simple ways of keeping the hello facing one direction during the entire land process?

Hate that spin thing it does.! I tryed while, SetDir, and such but no luck?


This is one that I had. I am still adding of course, it’s a bare bone model.

Code: [Select]
_heli = _this select 0;
_duration = _this select 1;
_dirEnd = _this select 2;
_Heliz = _This Select 3;
_Helip = GetPos _Heli Select 2;
_dirSTart = direction _heli;
_dirDiff = (_dirStart - _dirEnd) / _duration;

dOsTOP _heli;
Sleep 5;

_timeNow = time;
_timeFinal = _timeNow + _duration;

while {(time) <= _timeFinal} do {

_i = (time) - _timeNow;

_heli setdir (_dirStart - _dirDiff * _i);

hint str [_i,_dirDiff];

sleep 0.01; //--- Wait for next frame

while {_Helip > _Heliz} do {_Helip = _Helip -1; _Heli Flyinheight _Helip;};

};



Sleep 2;  // -- Enabeling Timer will stop the helo befor Decent Or Remove for a rolling landing (More Relistic.).


while {_Helip > _Heliz} do {_Helip = _Helip -1; _Heli Flyinheight _Helip;};

waitUntil {position _heli _Helip == _Heliz};

_Heli action ["engineOff", _Heli];

exit

lol I don’t even know if it works any more, But I will work on it and post something here if I can do anything more.

I know of one in the missions folder called "heliLanding.sqf"  I am going to analyze that one bit, until can find an alternative.

any help welcome :)

Here is a simple version of that file. I removed things not really needed for such a simple landing.

It allows the user to set the direction at landing, as well as other settings.
Usage is as follows:

Trigger or radio:
Code: [Select]
Null = [Helo_Name, Duration_of landing, End_Pos [x,y,z] Direction_end, velocity_end] ExecVM "scriptname.sqf";

Action Menu:
Code: [Select]
Menuname = player addAction ["Land", "scriptname.sqf", [Helo_Name, Duration_of landing, End_Pos [x,y,z] Direction_end, velocity_end],1];

And the Simple script
 
Code: [Select]
_heli = _this select 0;
_duration = _this select 1;
_posEnd = _this select 2;

_dirEnd = if (count _this > 3) then {_this select 3} else {direction _heli};
_velEnd = if (count _this > 4) then {_this select 4} else {velocity _heli};

_timeNow = time;
_timeFinal = _timeNow + _duration;

//--- Start
_posStart = getposasl _heli;
_posStartX = _posStart select 0;
_posStartY = _posStart select 1;
_posStartZ = _posStart select 2;

_posEndX = _posEnd select 0;
_posEndY = _posEnd select 1;
_posEndZ = _posEnd select 2;


_dirSTart = direction _heli;

_velStart = velocity _heli;
_velStartX = _velStart select 0;
_velStartY = _velStart select 1;
_velStartZ = _velStart select 2;

_velEndX = _velEnd select 0;
_velEndY = _velEnd select 1;
_velEndZ = _velEnd select 2;

//--- Difference
_posDiffX = (_posEndX - _posStartX) / _duration;
_posDiffY = (_posEndY - _posStartY) / _duration;
_posDiffZ = (_posEndZ - _posStartZ) / _duration;

_dirDiff = (_dirStart - _dirEnd) / _duration;

_velDiffX = (_velStartX - _velEndX) / _duration;
_velDiffY = (_velStartY - _velEndY) / _duration;
_velDiffZ = (_velStartZ - _velEndZ) / _duration;

while {(time) <= _timeFinal} do {
_i = (time) - _timeNow;

_heli setposASL [
_posStartX + _posDiffX * _i,
_posStartY + _posDiffY * _i,
_posStartZ + _posDiffZ * _i
];
/*
_heli setvelocity [
_posStartX - _posDiffX * _i,
_posStartY - _posDiffY * _i,
_posStartZ - _posDiffZ * _i
];
*/
_heli setdir (_dirStart - _dirDiff * _i);
};

exit;

Worked for me.

« Last Edit: 10 Feb 2011, 04:44:46 by Bingoz »