{"name":"setVectorUp","operator":null,"title":"setVectorUp","type":"command","url":"https://community.bistudio.com/wiki/setVectorUp","revid":377596,"updated":"2026-01-02T07:00:50Z","groups":["Math - Vectors"],"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":"local","effect":"global","server_exec":false},"exec":null,"description":"Set object's up vector. Direction of the object remain unchanged. Default object's vectorUp is [0,0,1].","syntaxes":[{"syntax":"object setVectorUp vectorUp","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":"vectorUp","type":null,"optional":false,"default":null,"description":"Vector3D (normalised)","types":["Vector3D"],"since":null,"text":"vectorUp: Vector3D (normalised)"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"object","types":["Object"]},"right":{"text":"vectorUp","types":["Vector3D"]}}],"examples":[{"text":"Turn object upside down:\n\n```sqf\n_obj setVectorUp [0, 0, -1];\n```","code":["_obj setVectorUp [0, 0, -1];"]},{"text":"Align object with the terrain underneath:\n\n```sqf\n_obj setVectorUp surfaceNormal getPosASL _obj;\n```","code":["_obj setVectorUp surfaceNormal getPosASL _obj;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["vectorDir","vectorUp","setVectorDir","setVectorDirAndUp","vectorDiff","vectorAdd","vectorMultiply","vectorCrossProduct","vectorDistance","vectorMagnitudeSqr","vectorDistanceSqr","vectorCos","vectorMagnitude","vectorDotProduct","vectorNormalized","vectorFromTo"],"notes":[{"user":"General Barron","date":"2009-03-03T21:07:00Z","text":"setVectorUp can only influence an object's bank. It can not influence pitch. Example:\n\n```sqf\nplayer setVectorUp [0, 1, 0]\n```\n\nIf the player is facing 0 degrees (north), then this will do NOTHING.\n\nIf the player is facing 90 degrees (east), then this will make him bank 90 degrees to his left."},{"user":"Kronzky","date":"2007-03-22T05:07:00Z","text":"An in-depth discussion on the concept of vectors is available [here](http://forums.bistudio.com/showthread.php?t=50914)."},{"user":"Str","date":"2008-03-16T09:49:00Z","text":"Command can be also used to rotate camera in all three axis (which also mean it is possible to set camera bank)."},{"user":"Killzone_Kid","date":"2013-10-03T09:04:00Z","text":"It is possible to change both pitch and bank of an object (surfaceNormal application for instance).\nAssuming an ammo box in the following example is facing North (default direction is 0):\n\n```sqf\n_ammobox setVectorUp [0, 1, 0]; // box is pitched 90 degrees forward\n_ammobox setVectorUp [1, 0, 0]; // box is banked 90 degrees to the right\n```\n\nHowever the above will stop working as soon as you attach the box to something. The following trick however will work in this case:\n\n```sqf\n_ammobox attachTo [player, [0, 2, 1]];\n_ammobox setVectorUp [0, 0.99, 0.01]; // box is pitched ~90 degrees forward\n_ammobox setVectorUp [0.99, 0, 0.01]; // box is banked ~90 degrees to the right\n```"}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Math - Vectors","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"]}