modelToWorld: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) mNo edit summary |
Killzone Kid (talk | contribs) (syntax) |
||
Line 16: | Line 16: | ||
|p1= object: [[Object]] |= Parameter 1 | |p1= object: [[Object]] |= Parameter 1 | ||
|p2= modelPos: [[ | |p2= modelPos: [[PositionRelative]] - [x,y,z] offset relative to the model centre |= Parameter 2 | ||
| [[Array]] - world position in format [[ | | [[Array]] - world position in format [[PositionAGL]] |= Return value | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|x1= <code>_aboveAndBehindPlayer = [[player]] [[modelToWorld]] [0,-1,3];</code> | |x1= <code>_aboveAndBehindPlayer = [[player]] [[modelToWorld]] [0,-1,3];</code> |
Revision as of 15:08, 13 August 2015
Description
- Description:
- Converts position from object model space to world space. This command will take into account vectorUp of the object when calculating relative coordinates.
- Groups:
- Uncategorised
Syntax
- Syntax:
- object modelToWorld modelPos
- Parameters:
- object: Object
- modelPos: PositionRelative - [x,y,z] offset relative to the model centre
- Return Value:
- Array - world position in 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 _obj but it does not give the same result, therefore (_obj modelToWorld [0.0, 0.0, 0.0]) is not the same as (getPos _obj).