Jump to content
mrflay

FLAY Hang Glider Mod

Recommended Posts

OK so I had a go of this last night and have to be honest, I failed miserably. Turning left or right with the keyboard proved fatal and I just didn't seem to be able to get any lift. I tried to head out to the thermal on the little island but crashed before i reached it. I think the sample mission would benefit from a bit of a basics tutorial to get people started. Also some markers (in-game and on map) for the thermals would be invaluable. There's some 3d arrows you can use in the editor for in-game.

Also whats with all the OPFOR everywhere? Its bad enough trying to get a hang of the handling let alone whilst being shot at :p I died a few times from that :(

Complaints aside its brilliant and I look forward to future updates, well done. Oh and I recommend updating your original post with download info, controls etc. Saves people scouring through the thread for details.

Share this post


Link to post
Share on other sites
OK so I had a go of this last night and have to be honest, I failed miserably. Turning left or right with the keyboard proved fatal and I just didn't seem to be able to get any lift. I tried to head out to the thermal on the little island but crashed before i reached it. I think the sample mission would benefit from a bit of a basics tutorial to get people started. Also some markers (in-game and on map) for the thermals would be invaluable. There's some 3d arrows you can use in the editor for in-game.

Great feedback! I'll look into adding some sort of tutorial to the sample mission before the next update. As for marking the locations of thermals, there is a radio trigger ("charlie") that will show their location. I've added the possibility to increase the speed by pushing "Forward" key on the keyboard. It's cheating, but helps to stay in the air when there are no thermals around.

I'll try to improve other input methods in the future. In the mean time, the recommend way to pilot the glider is with mouse and keyboard (it's the only thing I have tested).

My preferred key mapping in spoiler.

mrflay.Arma3AlphaProfile

keyHeliForward[]={1048579}; // mouse down
keyHeliBack[]={1048578}; // mouse up
keyHeliLeft[]={1048576}; // mouse left
keyHeliRight[]={1048577}; // mouse right
keyHeliRudderLeft[]={30}; // a
keyHeliRudderRight[]={32}; // d
keyAirBankLeft[]={};
keyAirBankRight[]={};
keyHeliFastForward[]={}; // <- default is 18, which makes heli dive when pressing 'e' (not possible to change in ui).
mouseSmoothing=100; 
mouseAcceleration=1; 

Also whats with all the OPFOR everywhere? Its bad enough trying to get a hang of the handling let alone whilst being shot at :p I died a few times from that :(

The only purpose of OPFOR is to stop you from having a good time ;)

Complaints aside its brilliant and I look forward to future updates, well done. Oh and I recommend updating your original post with download info, controls etc. Saves people scouring through the thread for details.

Thanks and will do.

Share this post


Link to post
Share on other sites
I can't get flytec 3040 to work, any ideas ?

Have you tried the radio command?

press 0 then 0 then 1 to toggle it.

0 then 0 then 2 to toggle sound.

and finally 0 then 0 then 3 to toggle display of thermal markers.

Share this post


Link to post
Share on other sites

I LOVE THIS ADDON !!!!! I'm an "old" paraglider (in real life) and I had the project to make a simulation of paragliding in Arma 3... I'm very happy to see that someone did it before me ;), with great talent ! It doesn't matter if I still have some difficulties to land softly, but I found the general handling great ! Don't touch anything, it's near perfection !

however a few suggestions :

1) the option "Disassemble" is active, even if we are in the hang glider. It would be a good idea to desactive this option, especially because enabling this option when "on board" teleport you far away (I suspect coords [0,0,0]) and you die.

2) Speaking about the disassembling, I found more realistic to use a small animation instead of an immediate disassembling (something like the "AinvPknlMstpSnonWnonDnon_medic_2" in Arma 2 => kneeling occupy to do something; healing in fact, but could be something else).

3) I found the wheels too "angular". As it's something we constantly see, may be smoother wheels, less low poly, would be desirable.

But the way to simulate thermals disappointed me a little bit (but it seems a good solution for IA), so I decide to scripting... something else : I try to simulate "ridge soaring" according to the ground. For now, it's quite simple and not very optimized : the script loops forever (:(...just for tests;)), and calculate the normal vector of some faces of the ground, then it compares the direction of the faces with the direction of the wind. An ascending/descending coefficient is calculated according to those parameters and apply with the exact method you use (see "_vehicle setVelocity [..." in both our scripts). In practice, for example, if the wind comes from West and we fly over a mountain with a ridge oriented North-South (so there's one slope descending westward and one eastward); as long as you stay to the left of the ridge (on the west slope), you are in the updrafts and you climb; but if you go over the slope right (= east) of the ridge, you are in the downdrafts and you descend, more or less quickly.

For now, unless you make big mistakes, the script allows to fly a very long time. May be it's too easy to maintain flight, but it's very frustrating to crash often without succeeded... If potential feedbacks say it's to easy, I will make the fly harder. Moreover, I plan to recalculate the ascending/descending coefficient according to the force of the wind, the percentage of the slope; eventually I'd like to combine this "ridge soaring fly" with thermals "calculated" according the terrain type (rocky, dry grass, forest), the daytime, the weather,... but it's a far, far "dream" :)

Remember it's a "rough" programmation, but it may interessed you. I forgot to say it desactivates automaticaly if there's some of your "thermals" in the vicinity. So here's my script :

/*
FN_SOARING.SQF © Pumpkin
-----------------------------
Simulation of soaring flying
parameter(s) :  nul = [ force_wind_direction(optional) ] execVM "fn_soaring.sqf"
*/

_cnt = 0;
_strcoefavg = 0;
_strengthTotal = 0;
_wind = 0;
_windazt = -1;
if (count _this > 0) then { _windazt = _this select 0 };

for [{_infinite = 0},{_infinite <= 1},{_infinite = _infinite + 1}] do {

_vehicle = vehicle player;

posPlyer2D = [getpos player select 0, getpos player select 1];
// player globalchat format ["surface Type : %1", surfaceType posPlyer2D];

_vect = surfaceNormal posPlyer2D;
_vectx = _vect select 0;
_vecty = _vect select 1;
_vectz = _vect select 2;
_normv = sqrt (_vectx * _vectx + _vecty * _vecty + _vectz * _vectz);

// rem : normal vector for a horizontal plane = [0,0,1]
// rem : V.V' = ||V||.||V'||cos(a)
// V' = (0, 0 , 1) => x*0 + y*0 + z*1 = sqrt(x² + y² + z²) * sqrt(0² + 0² + 1²) * cos(a) => z = sqrt(x² + y² + z²) * cos(a)
// => cos(a) = z / sqrt(x² + y² + z²)
_angv = acos (_vectz / _normv);

// direction of face in degrees
_angf = _vectx atan2 _vecty;
if (_angf <= 0) then { _angf = 360 + _angf };

// "natural" wind or "artificial wind"
if (_windazt == -1) then { _wind = winddir } else { _wind = _windazt};
player globalchat format ["wind: %1", _wind];

// TODO: 1) weight/calculate the coef. with "windStr" result 2) weight/calculate the coef. with vertical angle "_angv"
_strcoef = abs (((360 - abs (_wind - _angf)) / 180) - 1);

// sampling counter
_cnt = _cnt + 1;

// sum coefs for average coef
_strcoefavg = (_strcoefavg + _strcoef);

// multiples faces samplings for smoother transitions
_nbfaces = 30;
if  (_cnt == _nbfaces) then {
	_strcoefavg = (_strcoefavg / _nbfaces) * (_nbfaces - 10);
	_cnt = (_nbfaces - 10);
	// ratio (0.4) depends of time set for the "sleep" (end of loop) : + "sleep" time is high, + ratio must be high (should perhaps calculate a
	// relationship between the two number) AND depends too of the number of surfaces sampled (the more sampled, the higher the ration must be)
	_strengthTotal = (_strcoefavg / _cnt - 0.5) * 0.4;
};

_soaring = true;
if (not ((vehicle player) isKindOf "FLAY_HangGlider")) then {_soaring = false};
if (getPosATL player select 2 < 10) then {_soaring = false};
// find the thermals affecting the vehicle
// maximum radius too look for thermals
_THERMAL_MAX_RADIUS = 1000;
_thermals = (position vehicle player) nearObjects ["FLAY_Thermal", _THERMAL_MAX_RADIUS];
{
	_thermal = _x;
	_thermalRadiusHorz = _thermal getVariable ["FLAY.HangGlider.lift.thermal.radius", 500];
	if ((vehicle player distance _thermal) <= _thermalRadiusHorz) then {_soaring = false; player globalchat "thermal influence" };
} forEach _thermals;

player globalchat format ["strenghTotal : %1", _strengthTotal];

if (_soaring) then {
	_vdir = vectorDir _vehicle;
	_vup = vectorUp _vehicle;
	_velocity = velocity _vehicle;
	_vehicle setVelocity [(_velocity select 0) + _strengthTotal * (_vdir select 0), (_velocity select 1) + _strengthTotal * (_vdir select 1), (_velocity select 2) + 6 * _strengthTotal * (_vup select 2)];
};

// !! if modif. "sleep" time=> modif. "_strengthTotal" ratio
sleep 0.1;
_infinite = 0;
};

Don't use "automatic wind direction" in editor, it's nearly impossible to fly correctly, because the wind direction changes too often.

Last word : you said "I don't have the skill to make textures, so I can't make a template." I'm greatly interested by this template. May be I'll draw the texture myself, may be a friend of mine could be interested by drawing the texture (he's an old texture-maker for IL-2 Sturmovik, accustomed to flying machines ;) ) No promises...

Share this post


Link to post
Share on other sites
I LOVE THIS ADDON !!!!! I'm an "old" paraglider (in real life) and I had the project to make a simulation of paragliding in Arma 3... I'm very happy to see that someone did it before me ;), with great talent ! It doesn't matter if I still have some difficulties to land softly, but I found the general handling great ! Don't touch anything, it's near perfection !

however a few suggestions :

1) the option "Disassemble" is active, even if we are in the hang glider. It would be a good idea to desactive this option, especially because enabling this option when "on board" teleport you far away (I suspect coords [0,0,0]) and you die.

2) Speaking about the disassembling, I found more realistic to use a small animation instead of an immediate disassembling (something like the "AinvPknlMstpSnonWnonDnon_medic_2" in Arma 2 => kneeling occupy to do something; healing in fact, but could be something else).

3) I found the wheels too "angular". As it's something we constantly see, may be smoother wheels, less low poly, would be desirable.

But the way to simulate thermals disappointed me a little bit (but it seems a good solution for IA), so I decide to scripting... something else : I try to simulate "ridge soaring" according to the ground. For now, it's quite simple and not very optimized : the script loops forever (:(...just for tests;)), and calculate the normal vector of some faces of the ground, then it compares the direction of the faces with the direction of the wind. An ascending/descending coefficient is calculated according to those parameters and apply with the exact method you use (see "_vehicle setVelocity [..." in both our scripts). In practice, for example, if the wind comes from West and we fly over a mountain with a ridge oriented North-South (so there's one slope descending westward and one eastward); as long as you stay to the left of the ridge (on the west slope), you are in the updrafts and you climb; but if you go over the slope right (= east) of the ridge, you are in the downdrafts and you descend, more or less quickly.

For now, unless you make big mistakes, the script allows to fly a very long time. May be it's too easy to maintain flight, but it's very frustrating to crash often without succeeded... If potential feedbacks say it's to easy, I will make the fly harder. Moreover, I plan to recalculate the ascending/descending coefficient according to the force of the wind, the percentage of the slope; eventually I'd like to combine this "ridge soaring fly" with thermals "calculated" according the terrain type (rocky, dry grass, forest), the daytime, the weather,... but it's a far, far "dream" :)

Remember it's a "rough" programmation, but it may interessed you. I forgot to say it desactivates automaticaly if there's some of your "thermals" in the vicinity. So here's my script :

/*
FN_SOARING.SQF © Pumpkin
-----------------------------
Simulation of soaring flying
parameter(s) :  nul = [ force_wind_direction(optional) ] execVM "fn_soaring.sqf"
*/

_cnt = 0;
_strcoefavg = 0;
_strengthTotal = 0;
_wind = 0;
_windazt = -1;
if (count _this > 0) then { _windazt = _this select 0 };

for [{_infinite = 0},{_infinite <= 1},{_infinite = _infinite + 1}] do {

_vehicle = vehicle player;

posPlyer2D = [getpos player select 0, getpos player select 1];
// player globalchat format ["surface Type : %1", surfaceType posPlyer2D];

_vect = surfaceNormal posPlyer2D;
_vectx = _vect select 0;
_vecty = _vect select 1;
_vectz = _vect select 2;
_normv = sqrt (_vectx * _vectx + _vecty * _vecty + _vectz * _vectz);

// rem : normal vector for a horizontal plane = [0,0,1]
// rem : V.V' = ||V||.||V'||cos(a)
// V' = (0, 0 , 1) => x*0 + y*0 + z*1 = sqrt(x² + y² + z²) * sqrt(0² + 0² + 1²) * cos(a) => z = sqrt(x² + y² + z²) * cos(a)
// => cos(a) = z / sqrt(x² + y² + z²)
_angv = acos (_vectz / _normv);

// direction of face in degrees
_angf = _vectx atan2 _vecty;
if (_angf <= 0) then { _angf = 360 + _angf };

// "natural" wind or "artificial wind"
if (_windazt == -1) then { _wind = winddir } else { _wind = _windazt};
player globalchat format ["wind: %1", _wind];

// TODO: 1) weight/calculate the coef. with "windStr" result 2) weight/calculate the coef. with vertical angle "_angv"
_strcoef = abs (((360 - abs (_wind - _angf)) / 180) - 1);

// sampling counter
_cnt = _cnt + 1;

// sum coefs for average coef
_strcoefavg = (_strcoefavg + _strcoef);

// multiples faces samplings for smoother transitions
_nbfaces = 30;
if  (_cnt == _nbfaces) then {
	_strcoefavg = (_strcoefavg / _nbfaces) * (_nbfaces - 10);
	_cnt = (_nbfaces - 10);
	// ratio (0.4) depends of time set for the "sleep" (end of loop) : + "sleep" time is high, + ratio must be high (should perhaps calculate a
	// relationship between the two number) AND depends too of the number of surfaces sampled (the more sampled, the higher the ration must be)
	_strengthTotal = (_strcoefavg / _cnt - 0.5) * 0.4;
};

_soaring = true;
if (not ((vehicle player) isKindOf "FLAY_HangGlider")) then {_soaring = false};
if (getPosATL player select 2 < 10) then {_soaring = false};
// find the thermals affecting the vehicle
// maximum radius too look for thermals
_THERMAL_MAX_RADIUS = 1000;
_thermals = (position vehicle player) nearObjects ["FLAY_Thermal", _THERMAL_MAX_RADIUS];
{
	_thermal = _x;
	_thermalRadiusHorz = _thermal getVariable ["FLAY.HangGlider.lift.thermal.radius", 500];
	if ((vehicle player distance _thermal) <= _thermalRadiusHorz) then {_soaring = false; player globalchat "thermal influence" };
} forEach _thermals;

player globalchat format ["strenghTotal : %1", _strengthTotal];

if (_soaring) then {
	_vdir = vectorDir _vehicle;
	_vup = vectorUp _vehicle;
	_velocity = velocity _vehicle;
	_vehicle setVelocity [(_velocity select 0) + _strengthTotal * (_vdir select 0), (_velocity select 1) + _strengthTotal * (_vdir select 1), (_velocity select 2) + 6 * _strengthTotal * (_vup select 2)];
};

// !! if modif. "sleep" time=> modif. "_strengthTotal" ratio
sleep 0.1;
_infinite = 0;
};

Don't use "automatic wind direction" in editor, it's nearly impossible to fly correctly, because the wind direction changes too often.

Last word : you said "I don't have the skill to make textures, so I can't make a template." I'm greatly interested by this template. May be I'll draw the texture myself, may be a friend of mine could be interested by drawing the texture (he's an old texture-maker for IL-2 Sturmovik, accustomed to flying machines ;) ) No promises...

How do we use your script pumpkin?, thank's... :)

Share this post


Link to post
Share on other sites

however a few suggestions :

1) the option "Disassemble" is active, even if we are in the hang glider. It would be a good idea to desactive this option, especially because enabling this option when "on board" teleport you far away (I suspect coords [0,0,0]) and you die.

2) Speaking about the disassembling, I found more realistic to use a small animation instead of an immediate disassembling (something like the "AinvPknlMstpSnonWnonDnon_medic_2" in Arma 2 => kneeling occupy to do something; healing in fact, but could be something else).

3) I found the wheels too "angular". As it's something we constantly see, may be smoother wheels, less low poly, would be desirable.

Wow, I haven't checked this thread for quite some time. Sorry I missed your post! I'll try to get this stuff sorted for the next update (I'm hoping close to A3 launch, if time permits).

Can I bundle your script with the addon?

Last word : you said "I don't have the skill to make textures, so I can't make a template." I'm greatly interested by this template. May be I'll draw the texture myself, may be a friend of mine could be interested by drawing the texture (he's an old texture-maker for IL-2 Sturmovik, accustomed to flying machines ;) ) No promises...

The addon source and models are available on github: https://github.com/mrflay/FLAY_HangGlider

However, the model lacks UV coordinates.

Share this post


Link to post
Share on other sites
Wow, I haven't checked this thread for quite some time. Sorry I missed your post! I'll try to get this stuff sorted for the next update (I'm hoping close to A3 launch, if time permits).

Can I bundle your script with the addon?

The addon source and models are available on github: https://github.com/mrflay/FLAY_HangGlider

However, the model lacks UV coordinates.

Nice to see your still involved with this mod, waiting for updates... :)

Share this post


Link to post
Share on other sites
How do we use your script pumpkin?, thank's... :)

1. Create and save a new mission.

2. Create a new text file in the mission directory and copy-paste his script to it.

3. Name the text file "fn_soaring.sqf".

4. Preview the mission.

5. Open debug console and type

nul = [] execVM "fn_soaring.sqf";

6. Press enter and continue the game.

Share this post


Link to post
Share on other sites
I put in an init.sqf file and added this execVM "fn_soaring.sqf";

It pulled up a few errors but this is what I ended up with in bottom left corner, that right ?

Yes, that works too :) However, you should replace "this" with empty brackets [] for automatic wind direction, or a number (0-360) within brackets for hard coded wind direction, eg. [90].

Share this post


Link to post
Share on other sites
Wow, I haven't checked this thread for quite some time. Sorry I missed your post! I'll try to get this stuff sorted for the next update (I'm hoping close to A3 launch, if time permits).

I haven't checked the thread for a long time too, because I was away on vacation. Apparently, you just reply when I leaved... too bad ! When I'm on vacation, I totally "disconnected" so I wasn't aware of your answer, sorry !

Can I bundle your script with the addon?
Of course you can !!! I reply here, on this thread, thinking you might be interested. Apparently you are, so use the script as you want ! I'll let you correct/adapt the script to your convenience ? It's written a little bit too "roughly", but I'm not worried about your coding skill ;) :D In the same time, I probably improve the script, especially with the use of the "vertical angle". I suppose you notice that it isn't currently use (cf variable _angv), I expect to do something like : the more the terrain is flat, the less the wind will be effective. For the moment, only the orientation of the ground faces is used to calculate the strengh of the updrafts/downdrafts coeficient. I think I'll take care of it because it bothers me to leave the script at this point, and it takes a long time to test, especially in order to assay the difficulty of flight (thereupon feedbacks are welcome)
The addon source and models are available on github: https://github.com/mrflay/FLAY_HangGlider
Got it, thank you very much !
However, the model lacks UV coordinates.
It doesn't matter. I have some 3D tools to create a UV map. the biggest problem is to convince my friend to do the job (I'm not very good with photoshop)

---------- Post added at 11:31 ---------- Previous post was at 11:20 ----------

I put in an init.sqf file and added this execVM "fn_soaring.sqf";

It pulled up a few errors but this is what I ended up with in bottom left corner, that right ?.

I'll complete what mrflay said : I use brackets for possible future parameters. For the moment, there only one parameter used to "force" the wind direction (eg. mrflay indicates you with nul = [90] execVM "fn_soaring.sqf"; , which force the wind direction at 90°). If the brackets are empty, it's the direction of the wind "in game" that is used, but be careful in this case (read below)

Your video show me that, in fact, you didn't really test the script because the script is desactivated when the player/hangglider is in the vicinity of a thermal (eg. when you read a chat line "thermal influence"). Use the thermal to gain altitude if you want (it's more easy !), then leave the thermal and fly away, where you want. The second thing your video show me is that you will have a lot of difficulties to maintain fly because you didn't "force" the wind direction; you have two methods to do this : 1) put the wind direction in the brackets, as indicated by mrflay, or 2) in the mission editor, you can set the wind parameters manually with the "infos" (french name... I don't know the english name, shortcut = Ctrl+W). Don't let the game choose automatically the wind direction ! The game change automaticaly the direction too often, too quickly and too significant... I never saw that in the nature. Do not care about the "strenghTotal : blablabla", it's just a quick realtime debug information !

In gross, the script permits sort of ridge lift : for exemple, if the wind comes from full east (90°), you must stay on the east side of a moutain to maintain fly and/or climb. On the contrary, if you fly over the west side of a mountain, you will descend due to downdrafts. The more the side of the moutain is oriented to east, the more you climb; the more the side of the moutain is oriented to west, the more you descend... it's a simplified ridge fly.

Share this post


Link to post
Share on other sites

I write a "final" version of my script. Now it takes into account the altitude (less wind effect at high altitude) and the degree of the slope (less effect over little slope). I think I won't alter it in the future, except if bugs are discovered. May be mrflay will alter/improve it when he bundles it in his addon. Here it is :

/*

FN_SOARING.SQF © Pumpkin v2.0
-----------------------------
Simulation of soaring flying

parameter(s) :  nul = [ scalar: wind_direction (optional), boolean : debug message (optional)] execVM "fn_soaring.sqf"

note :
the order of parameters is inconsequential
TODO (MAYBE) :
- check surfaces type to simulate thermal - CONS: very dependant on the map/island
- weight/calculate the coef. with command "windStr" result

*/

// force of the wind effect: calculated using a cosine function with altitude reduced to an angle of 0 to 90 °
// alt = 0 => cos 0 = 1 : max power effect; alt = 400 => ~cos 90 = 0 : no wind effect;
// decreasing altitude = less wind effect & fly more difficult
_windeffect = 400 / 90;

// approximate angle of the faces producing maximum effect of wind; increasing = less wind effect & fly more difficult
_gradienteffect = 40;

// nb faces sampled for each strengh coef calculated
_nbfaces = 30;


// just inits (sometimes I don't like "private" declarations :D )
_cnt = 0;
_vertangavg = 0;
_strcoefavg = 0;
_vertangTotal = 0;
_strengthTotal = 0;
_wind = 0;
_msg = "";

// parameter(s)
_windazt = -1;
_debug = false;
if (count _this > 0) then {
_param = _this select 0;
if (typename _param == "SCALAR") then { _windazt = _param };
if (typename _param == "BOOL") then { _debug = _param };
};
if (count _this > 1) then {
_param = _this select 1;
if (typename _param == "SCALAR") then { _windazt = _param };
if (typename _param == "BOOL") then { _debug = _param };
};



for [{_infinite = 0},{_infinite <= 1},{_infinite = _infinite + 1}] do {

_vehicle = vehicle player;

posPlyer2D = [getpos player select 0, getpos player select 1];

_vect = surfaceNormal posPlyer2D;
_vectx = _vect select 0;
_vecty = _vect select 1;
_vectz = _vect select 2;
_normv = sqrt (_vectx * _vectx + _vecty * _vecty + _vectz * _vectz);

// rem : normal vector for a horizontal plane = [0,0,1]
// rem : V.V' = ||V||.||V'||cos(a)
// V' = (0, 0 , 1) => x*0 + y*0 + z*1 = sqrt(x² + y² + z²) * sqrt(0² + 0² + 1²) * cos(a)
// => z = sqrt(x² + y² + z²) * cos(a) => cos(a) = z / sqrt(x² + y² + z²)
_angv = acos (_vectz / _normv);
// sum vertical angles for average angle
_vertangavg = (_vertangavg + _angv);

// direction of face in degrees
_angf = _vectx atan2 _vecty;
if (_angf <= 0) then { _angf = 360 + _angf };

// "natural" wind or "artificial wind"
if (_windazt == -1) then { _wind = windDir } else { _wind = _windazt};

//>> FOR DEBUG >>
if (_debug) then {
	_msg = format["<t color='#ffff00' size='0.8'>Altitude ASL:<t/><br/><t color='#ffffff' size='1'>%1<t/><br/>", getposasl player select 2];
	_msg = _msg + format["<t color='#ffff00' size='0.8'>Altitude ATL:<t/><br/><t color='#ffffff' size='1'>%1<t/><br/>", getposatl player select 2];
};
//<< FOR DEBUG <<

_strcoef = abs (((360 - abs (_wind - _angf + 180)) / 180) - 1);

// sampling counter
_cnt = _cnt + 1;
// sum coefs for average coef
_strcoefavg = (_strcoefavg + _strcoef);

// multiples faces samplings for smoother transitions, updated every 10 faces
// 1st sampling :  ... {n-30 . n-20 . n-10} . n . n+10 . n+20 . n+30 ...
// 2nd sampling :  ... n-30 . {n-20 . n-10 . n} . n+10 . n+20 . n+30 ...
// 3rd sampling :  ... n-30 . n-20 . {n-10 . n . n+10} . n+20 . n+30 ...
// and so on...
if  (_cnt == _nbfaces) then {
	_cnt = _nbfaces - 10;
	_strcoefavg = (_strcoefavg / _nbfaces) * _cnt;
	_vertangavg = (_vertangavg / _nbfaces) * _cnt;
	//  value "0.4" sets to be near the values of mrflay. ratio "0.4" depends of time set for the "sleep" (end of loop) : + "sleep" time is high, + ratio must be high
	// (should perhaps calculate a relationship between the two number) AND depends too of the number of surfaces sampled (the more sampled, the higher the ration must be)
	_strengthTotal = (_strcoefavg / _cnt - 0.5) * 0.4;

	// weighting by the vertical angle
	_vertangTotal = (_vertangavg / _cnt) / _gradienteffect;
	_strengthTotal = (_strengthTotal * _vertangTotal) * cos ((getposATL player select 2) / _windeffect);
};

_soaring = true;
if (not ((vehicle player) isKindOf "FLAY_HangGlider")) then {_soaring = false};
if (getPosATL player select 2 < 10) then {_soaring = false};
// find the thermals affecting the vehicle
// maximum radius too look for thermals
_THERMAL_MAX_RADIUS = 1000;
_thermals = (position vehicle player) nearObjects ["FLAY_Thermal", _THERMAL_MAX_RADIUS];
{
	_thermal = _x;
	_thermalRadiusHorz = _thermal getVariable ["FLAY.HangGlider.lift.thermal.radius", 500];
	if ((vehicle player distance _thermal) <= _thermalRadiusHorz) then {_soaring = false};
	//>> FOR DEBUG >>
	if ( _debug and ((vehicle player distance _thermal) <= _thermalRadiusHorz) ) then {_msg = _msg + "<t color='#ff0000' size='1.5'>thermal influence<t/><br/>"};
	//<< FOR DEBUG <<
} forEach _thermals;

//>> FOR DEBUG >>
if (_debug) then {
	//_msg = _msg + format["<t color='#808080' size='0.8'>wind effect :<t/><br/><t color='#808080' size='1'>%1<t/><br/>", cos ((getposATL player select 2) / _windeffect)];
	//_msg = _msg + format["<t color='#808080' size='0.8'>face effect :<t/><br/><t color='#808080' size='1'>%1<t/><br/>", _vertangTotal];
	_msg = _msg + format["<t color='#ffff00' size='1'>strenghTotal :<t/><br/><t color='#ff4000' size='2'>%1<t/><br/>", _strengthTotal];
	hintsilent parseText _msg;
};
//<< FOR DEBUG <<

if (_soaring) then {
	_vdir = vectorDir _vehicle;
	_vup = vectorUp _vehicle;
	_velocity = velocity _vehicle;
	_vehicle setVelocity [(_velocity select 0) + _strengthTotal * (_vdir select 0), (_velocity select 1) + _strengthTotal * (_vdir select 1), (_velocity select 2) + 6 * _strengthTotal * (_vup select 2)];
};

// !! if modif. "sleep" time=> modif. "_strengthTotal" ratio of 0.4
sleep 0.1;
_infinite = 0;
};

By the way, I made a big mistake in the previous version : I invert the wind direction. Not a very big bug, but disturbing. In fact, I discover that, for example, when the wind direction is set to 270°, it doesn't come FROM 270° but it goes TO 270° (I observe the direction of the cloud to notice this fact). To correct the OLD script, you must simply modify this line : _strcoef = abs (((360 - abs (_wind - _angf)) / 180) - 1); to _strcoef = abs (((360 - abs (_wind - _angf + 180)) / 180) - 1); Sorry for the mistake...

Same use as the old version : launch it with a trigger, in init.sqf,... as you want. The basic syntax is always nul = [] execVM "fn_soaring.sqf". Again you can optionnaly force the wind direction with a scalar parameter inside bracket. You can use a new optionnal parameter : a boolean "true" to display debug infos (it's set to false by default). The order of parameters is inconsequential, you can write nul = [270,true]... as well as nul = [true,270].... here's a very simple mission to test the script : http://pumpkin.ringard.org/arma/hangglider_2b.Altis.rar (take off quickly, fly to right in the direction of rocky hills, then... it's up to you ;) )

If I can have feedback to indicate to me, or better to mrflay, how you find the ridge/wave fly (too easy ? too difficult ?), it would be great. After many time of testing, I have no idea of the degree of difficulty of the flight.

good fly ;)

Edited by pumpkin

Share this post


Link to post
Share on other sites

I just discovered this mod and it's great!

A huge thank you to the creator

HUGE THANKS ..

How great idea

Strongly that I can play ...

I paraglider and I hope that one day there will be something for paragliding mm

again thank you

Christophe de France

Share this post


Link to post
Share on other sites

Trying really hard to get this to work. I can't see the hang-glider in any of the lists. And trying to open it from the mission file results in getting this error:

"You cannot play/edit this mission; it is dependent on downloadable content that has been deleted. A3_Soft_F_Ifrit, A3_Soft_F_Offroad."

Can someone please tell me what I am doing wrong?

Share this post


Link to post
Share on other sites
Trying really hard to get this to work. I can't see the hang-glider in any of the lists. And trying to open it from the mission file results in getting this error:

"You cannot play/edit this mission; it is dependent on downloadable content that has been deleted. A3_Soft_F_Ifrit, A3_Soft_F_Offroad."

Can someone please tell me what I am doing wrong?

It should be in the available in the "empty" side, so you need to place a regular unit down first. After that you should find an entry called "FLAY Hang Glider" in class "Air".

Hope this helps!

Share this post


Link to post
Share on other sites
It should be in the available in the "empty" side, so you need to place a regular unit down first. After that you should find an entry called "FLAY Hang Glider" in class "Air".

Hope this helps!

That helped... if only I knew the solution was this easy earlier on, cause I have been breaking my back over it for days on end. Lol.

Share this post


Link to post
Share on other sites

Hey Happy New Year Flay and i wanted to ask if you are going to release some updates for the Glider mod and your Bow and Arrow mod ?

Share this post


Link to post
Share on other sites
Hey Happy New Year Flay and i wanted to ask if you are going to release some updates for the Glider mod and your Bow and Arrow mod ?

Happy New Year!

Yes, next update will feature the following changes.

- Bundled pumpkin's thermal/ridge lift script (thanks pumpkin).

- Fixed explosion on impact (thanks Sakura_Chan).

- Fixed smoke on damage (thanks super-truite).

- Fixed harness obstructing view in first-person.

- Fixed low poly wheels in first-person.

- Bundled Arma 2 wind noise (thanks BIS!)

- Clean-up scripts & config files.

- Variometer available as user action.

- Leaning animation forward & backward to gain reduce speed.

And then I hope to be able to put more work into the archery mod, but it requires a lot of work unfortunately.

Share this post


Link to post
Share on other sites
Happy New Year!

Yes, next update will feature the following changes.

- Bundled pumpkin's thermal/ridge lift script (thanks pumpkin).

- Fixed explosion on impact (thanks Sakura_Chan).

- Fixed smoke on damage (thanks super-truite).

- Fixed harness obstructing view in first-person.

- Fixed low poly wheels in first-person.

- Bundled Arma 2 wind noise (thanks BIS!)

- Clean-up scripts & config files.

- Variometer available as user action.

- Leaning animation forward & backward to gain reduce speed.

And then I hope to be able to put more work into the archery mod, but it requires a lot of work unfortunately.

New version (0.2) available, see first page for download link.

It's now licensed under APL-SA as it includes sound files from Arma 2.

Edited by mrflay
removed dropbox download link

Share this post


Link to post
Share on other sites
Hey man,great work have one question ever thinked to make Gliding Suit???

Yes, but that would require a new character/uniform model which I don't know how to do. There is a basic (invisible) wingsuit that you can try by pressing shift+space when airborne in the hang glider. It's not very realistic, though.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×