BIS fnc relPos: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(26 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma2
____________________________________________________________________________________________
|version1= 1.00


| arma2 |= Game name
|game2= arma2oa
|version2= 1.50


|1.00|= Game version
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| <pre>
|game4= arma3
/************************************************************
|version4= 0.50
Relative Position


Parameters: [object or position, distance, direction]
|gr1= Positions


Returns a position that is a specified distance and compass
|gr2= Geometry
direction from the passed position or object.


Example: [player, 5, 100] call BIS_fnc_relPos
|descr= Returns a position that is a specified distance and compass direction from the passed position or object.
************************************************************/
{{Feature|arma3|In {{arma3}} use [[getPos]]' [[getPos#Syntax 3|alternative syntax]] instead.}}


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|s1= [origin, distance, direction] call [[BIS_fnc_relPos]]
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_relPos]]; --> |= Syntax
|p1= origin: [[Object]] or [[Position]] - object or position which should be used as initial point.


|p1= |= Parameter 1
|p2= distance: [[Number]] - distance from initial point


| |= Return value
|p3= direction: [[Number]] - direction from the intial position
____________________________________________________________________________________________


|x1= <code>
|r1= [[Position]]


//Lawman_Actual: "Will Create a nice spiral of flares from the player at 30 degree intervals and increasing distance"
|x1= <sqf>[[0,0,0], 1000, 50] call BIS_fnc_relPos; // [766.044,642.788,0]</sqf>


for "_x" from 0 to 1440 step 30 do{
|seealso= [[getPos]]
 
}}
_distance = (_x/100)*2;
_targetPos = [(getPos player), _distance, _x] call BIS_fnc_relPos;
_targetPos set [2,0];
_flare = "F_40mm_White" createVehicle _targetPos;
sleep 0.25;
 
};


</code> |=  
{{Note
____________________________________________________________________________________________
|user= Lawman Actual
|timestamp= 20160107192600
|text= The function appears to work in two dimensions, and as such can be used to find the position of a target relative to the player if bearing and distance are known.


| [[getPos]]|= See also
However, if there is a significant change in elevation between yourself and the target, the distance registered on a rangefinder (which is measuring in a 3-dimensional straight line) will always be larger than the two-dimensional value required for [[BIS_fnc_relPos]] and as such air-strikes and ordnance called in using such a function can miss by several hundred metres in extreme cases.


Currently searching for a method which incorporates the azimuth of the rangefinder in calculation.
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Geometry|{{uc:relPos}}]]
[[Category:Functions|{{uc:relPos}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:relPos}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:relPos}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:relPos}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:relPos}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on January 7, 2016 - 19:26 (UTC)</dd>
<dt class="note">[[User:Lawman Actual|Lawman Actual]]</dt>
<dd class="note">
The function appears to work in two dimensions, and as such can be used to find the position of a target relative to the player if bearing and distance are known.
However, if there is a significant change in elevation between yourself and the target, the distance registered on a ragefinder (which is measuring a 3 dimensional straight line) will always be larger than the two-dimensional value required for BIS_fnc_relPos and as such air-strikes and ordnance called in using such a function can miss by several hundred metres in extreme cases.
Currently searching for a method which incorporates the azimuth of the rangefinder in calculation.
</dd>
</dl>
<!-- DISCONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on March 25, 2017 - 20:36 (UTC)</dd>
<dt class="note">[[User:Feint|Feint]]</dt>
<dd class="note">
Since Arma 3 v1.55.133361, an alternative syntax was added to [[getPos]] that allows one to get a position that is a given distance and heading away from original object or position, the equivalent of BIS_fnc_relPos<br>
<br>
Example:<br>
<code>_relPos = _caller [[getPos]] [([[abs]] _boundingBoxDimensions) -0.2, _direction];</code>
is equal to:<br>
<code>_relPos = [_caller, ([[abs]] _boundingBoxDimensions) -0.2, _direction] [[call]] BIS_fnc_relPos;</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 14:07, 13 July 2022

Hover & click on the images for description

Description

Description:
Returns a position that is a specified distance and compass direction from the passed position or object.
Arma 3
In Arma 3 use getPos' alternative syntax instead.
Execution:
call
Groups:
PositionsGeometry

Syntax

Syntax:
[origin, distance, direction] call BIS_fnc_relPos
Parameters:
origin: Object or Position - object or position which should be used as initial point.
distance: Number - distance from initial point
direction: Number - direction from the intial position
Return Value:
Position

Examples

Example 1:
[[0,0,0], 1000, 50] call BIS_fnc_relPos; // [766.044,642.788,0]

Additional Information

See also:
getPos

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Lawman Actual - c
Posted on Jan 07, 2016 - 19:26 (UTC)
The function appears to work in two dimensions, and as such can be used to find the position of a target relative to the player if bearing and distance are known. However, if there is a significant change in elevation between yourself and the target, the distance registered on a rangefinder (which is measuring in a 3-dimensional straight line) will always be larger than the two-dimensional value required for BIS_fnc_relPos and as such air-strikes and ordnance called in using such a function can miss by several hundred metres in extreme cases. Currently searching for a method which incorporates the azimuth of the rangefinder in calculation.