{"name":"setPos","operator":null,"title":"setPos","type":"command","url":"https://community.bistudio.com/wiki/setPos","revid":377794,"updated":"2026-01-03T03:50:30Z","groups":["Positions"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"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":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":"global","server_exec":false},"exec":null,"description":"Sets object position to format PositionAGLS (over surface). The Z value is used to calculate the nearest surface below the provided position. If the surface is close, it uses the Z position of the surface. Otherwise, Z value becomes the offset from that surface.\n\n> [!IMPORTANT]\n> It is recommended to **avoid** this command when placing objects above other objects, due to the unpredictable behavior described above.","syntaxes":[{"syntax":"object setPos pos","since":null,"effect":null,"exec":null,"params":[{"name":"object","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"object: Object"},{"name":"pos","type":"PositionAGL or Position2D","optional":false,"default":null,"description":"if Position2D, Z will be set to 0","types":["PositionAGL","Position2D"],"since":null,"text":"pos: PositionAGL or Position2D - if Position2D, Z will be set to 0"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"pos","types":["PositionAGL","Position2D"]}}],"examples":[{"text":"```sqf\nplayer setPos [getPos player select 0, getPos player select 1, (getPos player select 2) +10];\n\n// the same as above using set (OFP:R v1.75)\n_pos = getPos player;\n_pos set [2, _pos select 2 + 10];\nplayer setPos _pos;\n\n// the same as above using modelToWorld (ArmA v1.00)\nplayer setPos (player modelToWorld [0,0,10]);\n\n// the same as above using vectorAdd (Arma 3 v1.22)\nplayer setPos (getPos player vectorAdd [0,0,10]);\n```","code":["player setPos [getPos player select 0, getPos player select 1, (getPos player select 2) +10];\n\n// the same as above using set (OFP:R v1.75)\n_pos = getPos player;\n_pos set [2, _pos select 2 + 10];\nplayer setPos _pos;\n\n// the same as above using modelToWorld (ArmA v1.00)\nplayer setPos (player modelToWorld [0,0,10]);\n\n// the same as above using vectorAdd (Arma 3 v1.22)\nplayer setPos (getPos player vectorAdd [0,0,10]);"]},{"text":"```sqf\n_obj setPos [getPos _obj select 0, getPos _obj select 1, -5];\n```","code":["_obj setPos [getPos _obj select 0, getPos _obj select 1, -5];"]},{"text":"```sqf\nplayer setPos (getPos _obj);\n```","code":["player setPos (getPos _obj);"]}],"multiplayer":"> [!NOTE]\n> **Armed Assault:** ArmA 1.00 to 1.06: this command has local effect, but some simulation types do synchronise their changes over the network whilst others do not.\n>\n> So far, the only known simulation type that doesn't synchronise its position over the net is \"static\" ().","problems":null,"aliases":[],"see_also":["setPosASL","getPos","setVehiclePosition","Position"],"notes":[{"user":"Hduregger","date":"2011-02-06T20:20:00Z","text":"Calling setPos on an object can cause the object's orientation to change. This depends on the terrain and/or objects below the object. This was tested by calling setPos on a test object with the position of a helicopter (modelToWorld with some offset). When flying over land the orientation of the test object would rapidly change depending on the slope of the ground and objects beneath it.\nComment applicable to Ver **1.96** and **earlier**:\n\n```sqf\nobj1 setPos [x,y,z]\n```\n\nWill place most objects z metres above ground level (negative numbers for underground). But if obj1 is a trigger then it will be placed z metres above sea level. This can be very useful if you want to check a unit's height above sea level but it can be a problem if you want to move a trigger to create an explosion or a sound. To move a trigger to a location at ground level:\n\n```sqf\ntriggername setPos [x,y,0];\ntriggername setPos [x,y,abs(getPos triggername select 2)];\n```\n\nNote for ArmA: Using setPos for a trigger will work in exactly the same way that setPos works for other objects - namely that setPos [x,y,z] will place the trigger z metres above ground level.\nsetPos for static objects like an ammo crate do not work in MP."},{"user":"Tankbuster","date":"2012-11-23T13:06:00Z","text":"You can use getPos and setPos on triggers."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Positions","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}