modelToWorld: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ") |
No edit summary |
||
Line 21: | Line 21: | ||
This command will take into account [[vectorUp]] of the object when calculating relative coordinates. | This command will take into account [[vectorUp]] of the object when calculating relative coordinates. | ||
For ASL version see [[modelToWorldWorld]] | For ASL version see [[modelToWorldWorld]] | ||
{{Feature|important|For [[setObjectScale|scaled objects]], the relative position will first be [[vectorMultiply|multiplied]] by the object scale.<br> | |||
For example, if the object scale is 2, {{ic|_obj modelToWorld [0,1,0]}} will be offset '''2 meters''' from the model center ({{ic|[0,0,0]}}). | |||
}} | |||
|s1= model [[modelToWorld]] position | |s1= model [[modelToWorld]] position |
Revision as of 15:56, 29 July 2021
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:
- Positions
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
- 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 asgetPos _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