modelToWorld: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replace - "</dt>" to "")
m (Text replace - "</dd>" to "")
Line 30: Line 30:
<!-- Note Section BEGIN -->
<!-- Note Section BEGIN -->


<dd class="notedate">Posted on 16 Feb, 2007</dd>
<dd class="notedate">Posted on 16 Feb, 2007
<dt class="note">'''[[User:Dr_Eyeball|Dr_Eyeball]]'''<dd class="note">
<dt class="note">'''[[User:Dr_Eyeball|Dr_Eyeball]]'''<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>
The ''worldPos'' parameter appears to be a relative offset to the position of ''object'', so it can often simply be [0,0,0].<BR>
Line 37: Line 37:
  _worldPos = _RelObj modelToWorld _Offset;
  _worldPos = _RelObj modelToWorld _Offset;
  _obj setPos _worldPos;
  _obj setPos _worldPos;
</dd>


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


<dd class="notedate">Posted on 8 May, 2008</dd>
 
<dd class="notedate">Posted on 8 May, 2008
<dt class="note">'''[[User:Dr_Eyeball|Dr_Eyeball]]'''<dd class="note">
<dt class="note">'''[[User:Dr_Eyeball|Dr_Eyeball]]'''<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.
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 setDir _angle;
  _ladder setPos (_building modelToWorld [_x, _y, _z]);
  _ladder setPos (_building modelToWorld [_x, _y, _z]);
</dd>


<dd class="notedate">Posted on 6 Feb, 2011</dd>
 
<dd class="notedate">Posted on 6 Feb, 2011
<dt class="note">'''[[User:Hduregger|Hduregger]]'''<dd class="note">
<dt class="note">'''[[User:Hduregger|Hduregger]]'''<dd class="note">
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.
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.
Line 58: Line 58:
but it does not give the same result, therefore
but it does not give the same result, therefore
  (_obj modelToWorld [0.0, 0.0, 0.0]) != (getPos _obj).
  (_obj modelToWorld [0.0, 0.0, 0.0]) != (getPos _obj).
</dd>
 


<!-- Note Section END -->
<!-- Note Section END -->

Revision as of 13:36, 21 October 2011


-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Converts position from object model space to world space.
Groups:
Uncategorised

Syntax

Syntax:
Array = object modelToWorld modelPos
Parameters:
object: Object
modelPos: Array
Return Value:
Array

Examples

Example 1:
_WorldPos=_object modelToWorld _ModelPos

Additional Information

See also:
worldToModel

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 _obj but it does not give the same result, therefore (_obj modelToWorld [0.0, 0.0, 0.0]) != (getPos _obj).

Bottom Section