M1ke_SK 230 Posted October 24, 2016 I am trying to attach 4x DemoCharge to barrel to make a explosive bomb. I have issue of understanding setVectorDirAndUp command. I managed to get 2 of 4 charges attach in right direction. What array need to set for setVectorDirAndUp to face them right ? Here is what I got so far: fn_bomb.sqf param ["_object"]; //Land_MetalBarrel_F { _c4 = "DemoCharge_Remote_Ammo" createVehicle [(getPos _object) select 0, (getPos _object) select 1, 2]; _c4 attachTo [_object, _x select 0]; _c4 setVectorDirAndUp (_x select 1); _c4 enableSimulationGlobal false; } forEach [ [[0,0.3,0], [[1,0,0],[0,1,0]]], [[0,-0.3,0], [[-1,0,0],[0,-1,0]]], [[0.3,0,0], [[1,-1,0],[1,1,0]]], //fix [[-0.3,0,0], [[1,1,0],[-1,1,0]]] //fix ]; This is simple 4 objects so no angles involved. I would like to attach more c4s facing right direction to barrel if possible. Share this post Link to post Share on other sites
johnnyboy 3742 Posted October 24, 2016 I personally struggle with VectorDirAndUP...not a physics guy...so its all trial and error for me. KK's blog post should help you though. Share this post Link to post Share on other sites
Larrow 2801 Posted October 24, 2016 _barrel = createVehicle [ "Land_MetalBarrel_F", player getPos [ 2, getDir player ], [], 0, "CAN_COLLIDE" ]; { _x params[ "_offset", "_dirAndUp" ]; _c4 = createVehicle [ "DemoCharge_Remote_Ammo", [0,0,0], [], 0, "CAN_COLLIDE" ]; _c4 attachTo [ _barrel, _offset ]; _c4 setVectorDirAndUp _dirAndUp; _c4 enableSimulationGlobal false; } forEach [ [[0,0.3,0], [[1,0,0],[0,1,0]]], [[0,-0.3,0], [[-1,0,0],[0,-1,0]]], [[0.3,0,0], [[0,-1,0],[1,0,0]]], [[-0.3,0,0], [[0,1,0],[-1,0,0]]] ]; 1 Share this post Link to post Share on other sites