{"name":"setVectorUp","title":"setVectorUp","type":"command","url":"https://community.bistudio.com/wiki/setVectorUp","revid":377596,"updated":"2026-01-02T07:00:50Z","groups":["Math - Vectors"],"status":"ok","games":{"ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofpe 1.00","arma3_since":"0.50","locality":{"argument":"local","effect":"global"},"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","params":[{"name":"object","type":"Object","type_expr":"Object"},{"name":"vectorUp","type":"Vector3D (normalised)","type_expr":"Vector3D"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"object"},"right":{"text":"vectorUp"}}],"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;"]}],"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.\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```"}]}