modelToWorld: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (see also) |
Lou Montana (talk | contribs) m (add modelToWorldWorld seeAlso link) |
||
Line 1: | Line 1: | ||
{{Command|Comments= | |||
{{Command|= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| arma | | | arma |Game name= | ||
|1.00| | |1.00|Game version= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Translates relative position from object model space into world position. This command will take into account [[vectorUp]] of the object when calculating relative coordinates. For ASL version see [[modelToWorldWorld]]|= | | Translates relative position from object model space into world position.<br /> | ||
This command will take into account [[vectorUp]] of the object when calculating relative coordinates. | |||
For ASL version see [[modelToWorldWorld]] |Description= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| model | | model [[modelToWorld]] position |Syntax= | ||
|p1= model: [[Object]] | | |p1= model: [[Object]] |Parameter 1= | ||
|p2= position: [[ | |p2= position: [[Position]] - [x,y,z] offset relative to the model centre, format [[PositionRelative]] |Parameter 2= | ||
| [[Array]] - translated world position, format [[PositionAGL]] | | | [[Array]] - translated world position, format [[PositionAGL]] |Return value= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_aboveAndBehindPlayer = [[player]] [[modelToWorld]] [0,-1,3];</code> | |x1= <code>_aboveAndBehindPlayer = [[player]] [[modelToWorld]] [0,-1,3];</code> |Example 1= | ||
| [[modelToWorldVisual]], [[worldToModel]], [[modelToWorldWorld]], [[selectionPosition]] |See also= | |||
}} | }} | ||
Line 31: | Line 30: | ||
<dd class="notedate">Posted on 16 Feb, 2007 | <dd class="notedate">Posted on 16 Feb, 2007 | ||
<dt class="note"> | <dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]] | ||
The ''worldPos'' parameter appears to be a relative offset to the position of ''object'', so it can often simply be [0,0,0].<BR> | <dd class="note">The ''worldPos'' parameter appears to be a relative offset to the position of ''object'', so it can often simply be [0,0,0].<BR> | ||
'''Example:''' to position an object ''_obj'' relative to the position of another object '' | '''Example:''' to position an object ''_obj'' relative to the position of another object ''_relObj'' with on offset of ''_offset'', try: | ||
<code>_offset = [_x,_y,_z]; | |||
_worldPos = _relObj modelToWorld _offset; | |||
_obj setPos _worldPos;</code> | |||
<dd class="notedate">Posted on 16 Feb, 2007 | <dd class="notedate">Posted on 16 Feb, 2007 | ||
<dt class="note"> | <dt class="note">[[User:Manny|Manny]] | ||
The object model space has got its Z-Axis along the object's [[vectorUp]], its Y-Axis along the object's [[vectorDir]], while its X-Axis goes along [http://en.wikipedia.org/wiki/Cross_product vectorDir x VectorUp] (meaning as the X-Axis in a [http://en.wikipedia.org/wiki/Cartesian_coordinate_system#In_three_dimensions right-handed cartesian coordiante system]). | <dd class="note">The object model space has got its Z-Axis along the object's [[vectorUp]], | ||
its Y-Axis along the object's [[vectorDir]], | |||
while its X-Axis goes along [http://en.wikipedia.org/wiki/Cross_product vectorDir x VectorUp] (meaning as the X-Axis in a [http://en.wikipedia.org/wiki/Cartesian_coordinate_system#In_three_dimensions right-handed cartesian coordiante system]). | |||
<dd class="notedate">Posted on 8 May, 2008 | <dd class="notedate">Posted on 8 May, 2008 | ||
<dt class="note"> | <dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]] | ||
If your object requires a new direction, ensure you call [[setDir]] ''prior'' to [[setPos]] when using [[modelToWorld]]. Calling setDir afterwards will skew its position otherwise. | <dd class="note">If your object requires a new direction, ensure you call [[setDir]] ''prior'' to [[setPos]] when using [[modelToWorld]]. | ||
Calling setDir afterwards will skew its position otherwise. | |||
_ladder setPos (_building modelToWorld [_x, _y, _z]); | <code>_ladder setDir _angle; | ||
_ladder setPos (_building modelToWorld [_x, _y, _z]);</code> | |||
<dd class="notedate">Posted on 6 Feb, 2011 | <dd class="notedate">Posted on 6 Feb, 2011 | ||
<dt class="note"> | <dt class="note">[[User:Hduregger|Hduregger]] | ||
The z height returned changes dynamically with the height of waves beneath the object, if the object is located over sea. The z height returned by [[getPosATL]] and [[getPosASL]] does not change like this. This was tested by continuously retrieving the position of a static object, like the cross in the empty/corpses category, placed over sea or land. | <dd class="note">The z height returned changes dynamically with the height of waves beneath the object, if the object is located over sea. | ||
[[modelToWorld ]] behaves similar to | The z height returned by [[getPosATL]] and [[getPosASL]] does not change like this. | ||
This was tested by continuously retrieving the position of a static object, like the cross in the empty/corpses category, placed over sea or land. | |||
but it does not give the same result, therefore | [[modelToWorld]] behaves similar to [[getPos]] but it does not give the same result, therefore | ||
<code>_obj modelToWorld [0.0, 0.0, 0.0]</code> | |||
is '''not''' the same as <code>getPos _obj</code>. | |||
<!-- Note Section END --> | <!-- Note Section END --> | ||
Line 64: | Line 66: | ||
<h3 style="display:none">Bottom Section</h3> | <h3 style="display:none">Bottom Section</h3> | ||
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]] | |||
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]] | ||
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] | [[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]] |
Revision as of 00:01, 21 August 2018
Description
- Description:
- Translates relative position from object model space into world position.
This command will take into account vectorUp of the object when calculating relative coordinates. For ASL version see modelToWorldWorld - Groups:
- Uncategorised
Syntax
- Syntax:
- model modelToWorld position
- Parameters:
- model: Object
- position: Position - [x,y,z] offset relative to the model centre, format PositionRelative
- Return Value:
- Array - translated world position, format PositionAGL
Examples
- Example 1:
_aboveAndBehindPlayer = player modelToWorld [0,-1,3];
Additional Information
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
Notes
- Posted on 16 Feb, 2007
- Dr_Eyeball
- The worldPos parameter appears to be a relative offset to the position of object, so it can often simply be [0,0,0].
Example: to position an object _obj relative to the position of another object _relObj with on offset of _offset, try:_offset = [_x,_y,_z]; _worldPos = _relObj modelToWorld _offset; _obj setPos _worldPos;
- Posted on 16 Feb, 2007
- Manny
- The object model space has got its Z-Axis along the object's vectorUp, its Y-Axis along the object's vectorDir, while its X-Axis goes along vectorDir x VectorUp (meaning as the X-Axis in a right-handed cartesian coordiante system).
- Posted on 8 May, 2008
- Dr_Eyeball
- If your object requires a new direction, ensure you call setDir prior to setPos when using modelToWorld.
Calling setDir afterwards will skew its position otherwise.
_ladder setDir _angle; _ladder setPos (_building modelToWorld [_x, _y, _z]);
- Posted on 6 Feb, 2011
- Hduregger
- The z height returned changes dynamically with the height of waves beneath the object, if the object is located over sea.
The z height returned by getPosATL and getPosASL does not change like this.
This was tested by continuously retrieving the position of a static object, like the cross in the empty/corpses category, placed over sea or land.
modelToWorld behaves similar to getPos but it does not give the same result, therefore
_obj modelToWorld [0.0, 0.0, 0.0]
is not the same asgetPos _obj
.