csj 0 Posted April 11, 2006 I would like the true sea level alt of an aircraft whislt over land or water. Does anybody have an idea how to do this? Share this post Link to post Share on other sites
hardrock 1 Posted April 11, 2006 The OFP-native functions setPos and getPos (or the alias position) work both above-land-level (except for EmptyDetectors). To work with positions above-sea-level you need the following functions: Selects the position above-sea-level of the given unit. Return value: position fGetPosASL.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_l","_z"]; _l = "EmptyDetector" camCreate [0,0,0]; _l setPos [getpos _this select 0,getpos _this select 1,0]; _z = (getpos _this select 2)-(getpos _l select 2); camDestroy _l; [getpos _this select 0,getpos _this select 1,_z] Usage: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">absPos = myUnit call fGetPosASL ----------------------------------------------------------------- Sets the position above-sea-level of the given unit. Return value: position fSetPosASL.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_l","_z","_p"]; _p = _this select 1; _l = "EmptyDetector" camCreate [0,0,0]; _l setPos [_p select 0, _p select 1, 0]; _z = getPos _l select 2; (_this select 0) setPos [_p select 0, _p select 1, (_p select 2)+_z]; camDestroy _l; [_p select 0, _p select 1, (_p select 2)+_z] Usage: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[myObject, myPosition] call fSetPosASL ----------------------------------------------------------------- Some more useful related functions: Changes the x-, y- or z-position of the given unit. Example: Can be used to set the height of a unit in an easy way. Return value: position fSetIPos.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_l","_z","_p","_i"]; _p = getPos (_this select 0); _p set [_this select 1,_this select 2]; (_this select 0) setPos _p; _p Usage: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[myUnit, myPositionIndex, myIndexValue] call fSetIPos Example: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[myUnit, 2, 50] call fSetIPos instead of <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">myUnit setPos [getPos myUnit select 0, getPos myUnit select 1, 50] ----------------------------------------------------------------- Changes the x-, y- or z-position of the given unit above-sea-level. Return value: position fSetIPosASL.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_l","_z","_p","_i"]; _p = getPos (_this select 0); _p set [_this select 1,_this select 2]; _l = "EmptyDetector" camCreate [0,0,0]; _l setPos [_p select 0, _p select 1, 0]; _z = getPos _l select 2; (_this select 0) setPos [_p select 0, _p select 1, (_p select 2)+_z]; camDestroy _l; [_p select 0, _p select 1, (_p select 2)+_z] Usage: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[myUnit, myPositionIndex, myIndexValue] call fSetIPosASL Share this post Link to post Share on other sites
csj 0 Posted April 11, 2006 Bonza ! Thanks hardrock Share this post Link to post Share on other sites