modelToWorld: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\{\{ *Wikipedia *\| *([-a-zA-Z0-9_#':%\/\\]+) *\| *([-a-zA-Z0-9_#':%\/\\ ]+) *\}\}" to "{{Link|https://en.wikipedia.org/wiki/$1|$2}}") |
Lou Montana (talk | contribs) m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>") |
||
Line 45: | Line 45: | ||
|text= The ''worldPos'' parameter appears to be a relative offset to the position of ''object'', so it can often simply be [0,0,0].<BR> | |text= 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 ''_relObj'' with on offset of ''_offset'', try: | '''Example:''' to position an object ''_obj'' relative to the position of another object ''_relObj'' with on offset of ''_offset'', try: | ||
<sqf>_offset = [_x,_y,_z]; | <sqf> | ||
_offset = [_x,_y,_z]; | |||
_worldPos = _relObj modelToWorld _offset; | _worldPos = _relObj modelToWorld _offset; | ||
_obj setPos _worldPos;</sqf> | _obj setPos _worldPos; | ||
</sqf> | |||
}} | }} | ||
Line 63: | Line 65: | ||
|text= If your object requires a new direction, ensure you call [[setDir]] ''prior'' to [[setPosATL]] when using [[modelToWorld]]. | |text= If your object requires a new direction, ensure you call [[setDir]] ''prior'' to [[setPosATL]] when using [[modelToWorld]]. | ||
Calling setDir afterwards will skew its position otherwise. | Calling setDir afterwards will skew its position otherwise. | ||
<sqf>_ladder setDir _angle; | <sqf> | ||
_ladder setPosATL (_building modelToWorld [_x, _y, _z]);</sqf> | _ladder setDir _angle; | ||
_ladder setPosATL (_building modelToWorld [_x, _y, _z]); | |||
</sqf> | |||
}} | }} | ||
Latest revision as of 11:34, 3 September 2024
Description
- Description:
- Translates relative position from object model space to world space in PositionAGL format.
This command will take into account vectorUp of the object when calculating relative coordinates. For the PositionASL version of this command, see modelToWorldWorld. - Groups:
- Positions
Syntax
- Syntax:
- model modelToWorld position
- Parameters:
- model: Object
- position: Array format PositionRelative - [x,y,z] offset relative to the model centre
- Return Value:
- Array format PositionAGL - translated world position
Examples
- Example 1:
Additional Information
- See also:
- vectorModelToWorld modelToWorldVisual worldToModel modelToWorldWorld modelToWorldVisualWorld selectionPosition
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 Feb 18, 2007 - 01:55 (UTC)
-
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:
- Posted on Jul 24, 2007 - 17:45 (UTC)
- 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 May 08, 2008 - 08:05 (UTC)
- If your object requires a new direction, ensure you call setDir prior to setPosATL when using modelToWorld. Calling setDir afterwards will skew its position otherwise.
- Posted on Feb 06, 2011 - 20:41 (UTC)
-
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
is not the same as_obj modelToWorld [0.0, 0.0, 0.0].getPos _obj;
Categories:
- Scripting Commands
- Introduced with Armed Assault version 1.00
- ArmA: Armed Assault: New Scripting Commands
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 2: Operation Arrowhead: Scripting Commands
- Take On Helicopters: Scripting Commands
- Arma 3: Scripting Commands
- Command Group: Positions