{"name":"setVehiclePosition","operator":null,"title":"setVehiclePosition","type":"command","url":"https://community.bistudio.com/wiki/setVehiclePosition","revid":377535,"updated":"2026-01-02T06:53:22Z","groups":["Positions","Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"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":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"global","effect":"global","server_exec":false},"exec":null,"description":"Moves the object to a given position (same as createVehicle placement algorithm). Uses either the position that's defined by the *position* param, or one of the marker positions from the markers array. The object is placed inside a circle with *position* as its center and *placement* as its radius. The type of placement could also be controlled with *special*.\n\nIf position is in water and the vehicle can float, it is placed on water surface, otherwise it is placed on the ground, even if the ground is under water. If roof surfaces support walking, units will be placed on roofs if such position is given.","syntaxes":[{"syntax":"object setVehiclePosition [position, markers, placement, special]","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":"position","type":"PositionATL (PositionAGL if boat or amphibious), Position2D, or Object","optional":false,"default":null,"description":"desired placement position.\nIf object is given, object position is used for *position*. Normally only *x* and *y* are considered, unless \"CAN_COLLIDE\" is used for special placement","types":["PositionATL","PositionAGL","Position2D","Object"],"since":null,"text":"position: PositionATL (PositionAGL if boat or amphibious), Position2D, or Object - desired placement position.\nIf object is given, object position is used for *position*. Normally only *x* and *y* are considered, unless \"CAN_COLLIDE\" is used for special placement"},{"name":"markers","type":"Array of Strings","optional":false,"default":null,"description":"if the markers array contains one or more marker names, the position is chosen randomly and could be one of the marker positions or just the supplied main position.\nIf marker had z coordinate set with setMarkerPos, the vehicle will be placed on the nearest surface below this z coordinate","types":["Array","String"],"since":null,"text":"markers: Array of Strings - if the markers array contains one or more marker names, the position is chosen randomly and could be one of the marker positions or just the supplied main position.\nIf marker had z coordinate set with setMarkerPos, the vehicle will be placed on the nearest surface below this z coordinate"},{"name":"placement","type":"Number","optional":false,"default":null,"description":"the vehicle is randomly placed inside a circle with given position as center and placement as its radius","types":["Number"],"since":null,"text":"placement: Number - the vehicle is randomly placed inside a circle with given position as center and placement as its radius"},{"name":"special","type":"String","optional":true,"default":"\"NONE\"","description":"can be one of the following:\n- `\"NONE\"` - will look for suitable empty position near given position (subject to other placement params) before placing vehicle there.\n- `\"CAN_COLLIDE\"` - places vehicle at given position (subject to other placement params), without checking if others objects can cross its 3D model.\n- `\"FLY\"` - if vehicle is capable of flying and has crew, it will be made airborne at default height.\nIf *special* is \"\" or not specified, default `\"NONE\"` is used.","types":["String"],"since":null,"text":"special: String - (Optional, default \"NONE\") can be one of the following:\n- `\"NONE\"` - will look for suitable empty position near given position (subject to other placement params) before placing vehicle there.\n- `\"CAN_COLLIDE\"` - places vehicle at given position (subject to other placement params), without checking if others objects can cross its 3D model.\n- `\"FLY\"` - if vehicle is capable of flying and has crew, it will be made airborne at default height.\nIf *special* is \"\" or not specified, default `\"NONE\"` is used."}],"returns":{"type":"Boolean","types":["Boolean"],"description":"true on success, false on failure","text":"Boolean - true on success, false on failure"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"[position, markers, placement, special]","types":["Array"]}}],"examples":[{"text":"```sqf\n// place the player at either [1000,2000], or one of the three markers positions\nplayer setVehiclePosition [[1000,2000], [\"Pos1\",\"Pos2\",\"Pos3\"], 0, \"CAN_COLLIDE\"];\n```","code":["// place the player at either [1000,2000], or one of the three markers positions\nplayer setVehiclePosition [[1000,2000], [\"Pos1\",\"Pos2\",\"Pos3\"], 0, \"CAN_COLLIDE\"];"]},{"text":"```sqf\nheli setVehiclePosition [player, [], 0, \"FLY\"];\n```","code":["heli setVehiclePosition [player, [], 0, \"FLY\"];"]},{"text":"```sqf\n_cam = \"camera\" camCreate [0,0,0];\n_cam setDir random 360;\n_cam setVehiclePosition [[5000,5000], [], 1000, \"NONE\"];\n_cam setPosWorld (getPosWorld _cam vectorAdd [0,0,1.8]);\n_cam cameraEffect [\"Internal\", \"Back\"];\n```","code":["_cam = \"camera\" camCreate [0,0,0];\n_cam setDir random 360;\n_cam setVehiclePosition [[5000,5000], [], 1000, \"NONE\"];\n_cam setPosWorld (getPosWorld _cam vectorAdd [0,0,1.8]);\n_cam cameraEffect [\"Internal\", \"Back\"];"]},{"text":"```sqf\nprivate _tablePos = player getRelPos [3, 0];\nprivate _table = \"Land_CampingTable_F\" createVehicle [0,0,0];\nprivate _laptop = \"Land_Laptop_unfolded_F\" createVehicle [0,0,0];\n_table setPos _tablePos;\n_laptop setVehiclePosition [_tablePos vectorAdd [0.5, 0.2, 10], [], 0, \"CAN_COLLIDE\"];\n_laptop attachTo [_table];\n```","code":["private _tablePos = player getRelPos [3, 0];\nprivate _table = \"Land_CampingTable_F\" createVehicle [0,0,0];\nprivate _laptop = \"Land_Laptop_unfolded_F\" createVehicle [0,0,0];\n_table setPos _tablePos;\n_laptop setVehiclePosition [_tablePos vectorAdd [0.5, 0.2, 10], [], 0, \"CAN_COLLIDE\"];\n_laptop attachTo [_table];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["setPos","createUnit","setPosASL","setPosWorld","createVehicle","Position"],"notes":[{"user":"Killzone_Kid","date":"2015-06-24T15:43:00Z","text":"If you need to set direction as well, set it before using setVehiclePosition. The command will use existing dir of the object for its calculations.\n\n```sqf\nplayer setDir random 360;\nplayer setVehiclePosition [player, [], 100, \"none\"];\n```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Command Group: Positions","Introduced with Operation Flashpoint: Elite version 1.00","Operation Flashpoint: Elite: New Scripting Commands","Operation Flashpoint: Elite: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}