{"name":"modelToWorld","operator":null,"title":"modelToWorld","type":"command","url":"https://community.bistudio.com/wiki/modelToWorld","revid":377424,"updated":"2026-01-02T06:45:36Z","groups":["Positions"],"status":"ok","replaced_by":[],"games":[{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma1","name":"Armed Assault","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"description":"Translates relative position from object model space to world space in PositionAGL format.\n\nThis command will take into account vectorUp of the object when calculating relative coordinates.\nFor the PositionASL version of this command, see modelToWorldWorld.\n\n> [!IMPORTANT]\n> For scaled objects, the relative position will first be multiplied by the object scale.\n>\n> For example, if the object scale is 2, `_obj modelToWorld [0,1,0]` will be offset **2 meters** from the model center (`[0,0,0]`).","syntaxes":[{"syntax":"model modelToWorld position","since":null,"effect":null,"exec":null,"params":[{"name":"model","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"model: Object"},{"name":"position","type":"PositionRelative","optional":false,"default":null,"description":"[x,y,z] offset relative to the model centre","types":["PositionRelative"],"since":null,"text":"position: PositionRelative - [x,y,z] offset relative to the model centre"}],"returns":{"type":"PositionAGL","types":["PositionAGL"],"description":"translated world position","text":"PositionAGL - translated world position"},"form":"binary","operator":null,"left":{"text":"model","types":["Object"]},"right":{"text":"position","types":["PositionRelative"]}}],"examples":[{"text":"```sqf\n_aboveAndBehindPlayer = player modelToWorld [0,-1,3];\n```","code":["_aboveAndBehindPlayer = player modelToWorld [0,-1,3];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["vectorModelToWorld","modelToWorldVisual","worldToModel","modelToWorldWorld","modelToWorldVisualWorld","selectionPosition"],"notes":[{"user":"Dr_Eyeball","date":"2007-02-18T01:55:00Z","text":"The *worldPos* parameter appears to be a relative offset to the position of *object*, so it can often simply be [0,0,0].\n\n**Example:** to position an object *_obj* relative to the position of another object *_relObj* with on offset of *_offset*, try:\n\n```sqf\n_offset = [_x,_y,_z];\n_worldPos = _relObj modelToWorld _offset;\n_obj setPos _worldPos;\n```"},{"user":"ManDay","date":"2007-07-24T17:45:00Z","text":"The object model space has got its Z-Axis along the object's vectorUp,\nits Y-Axis along the object's vectorDir,\nwhile its X-Axis goes along [vectorDir x VectorUp](https://en.wikipedia.org/wiki/Cross_product) (meaning as the X-Axis in a [right-handed cartesian coordiante system](https://en.wikipedia.org/wiki/Cartesian_coordinate_system#In_three_dimensions))."},{"user":"Dr_Eyeball","date":"2008-05-08T08:05:00Z","text":"If your object requires a new direction, ensure you call setDir *prior* to setPosATL when using modelToWorld.\nCalling setDir afterwards will skew its position otherwise.\n\n```sqf\n_ladder setDir _angle;\n_ladder setPosATL (_building modelToWorld [_x, _y, _z]);\n```"},{"user":"Hduregger","date":"2011-02-06T20:41:00Z","text":"The z height returned changes dynamically with the height of waves beneath the object, if the object is located over sea.\nThe z height returned by getPosATL and getPosASL does not change like this.\nThis was tested by continuously retrieving the position of a static object, like the cross in the empty/corpses category, placed over sea or land.\nmodelToWorld behaves similar to getPos but it does not give the same result, therefore\n\n```sqf\n_obj modelToWorld [0.0, 0.0, 0.0]\n```\n\nis **not** the same as \n\n```sqf\ngetPos _obj;\n```\n\n."}],"categories":["ArmA: Armed Assault: New Scripting Commands","ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Positions","Introduced with Armed Assault version 1.00","Scripting Commands","Take On Helicopters: Scripting Commands"]}