modelToWorld: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ |()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}")
m (Text replacement - " <dd class="notedate">" to " <dt><dt> <dd class="notedate">")
Line 25: Line 25:
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->
 
<dt><dt>
<dd class="notedate">Posted on 16 Feb, 2007</dd>
<dd class="notedate">Posted on 16 Feb, 2007</dd>
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]</dt>
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]</dt>
Line 34: Line 34:
_obj setPos _worldPos;</code>
_obj setPos _worldPos;</code>


 
<dt><dt>
<dd class="notedate">Posted on 16 Feb, 2007</dd>
<dd class="notedate">Posted on 16 Feb, 2007</dd>
<dt class="note">[[User:Manny|Manny]]</dt>
<dt class="note">[[User:Manny|Manny]]</dt>
Line 41: Line 41:
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]).
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]).


 
<dt><dt>
<dd class="notedate">Posted on 8 May, 2008</dd>
<dd class="notedate">Posted on 8 May, 2008</dd>
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]</dt>
<dt class="note">[[User:Dr_Eyeball|Dr_Eyeball]]</dt>
Line 49: Line 49:
  _ladder setPos (_building modelToWorld [_x, _y, _z]);</code>
  _ladder setPos (_building modelToWorld [_x, _y, _z]);</code>


 
<dt><dt>
<dd class="notedate">Posted on 6 Feb, 2011</dd>
<dd class="notedate">Posted on 6 Feb, 2011</dd>
<dt class="note">[[User:Hduregger|Hduregger]]</dt>
<dt class="note">[[User:Hduregger|Hduregger]]</dt>

Revision as of 01:10, 6 April 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
Positions

Syntax

Syntax:
Syntax needed
Parameters:
model: Object
position: Position - [x,y,z] offset relative to the model centre, format PositionRelative
Return Value:
Return value needed

Examples

Example 1:
_aboveAndBehindPlayer = player modelToWorld [0,-1,3];

Additional Information

See also:
vectorModelToWorldmodelToWorldVisualworldToModelmodelToWorldWorldmodelToWorldVisualWorldselectionPosition

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
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 as getPos _obj.