OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Gnat on 22 Nov 2008, 17:31:33
-
Hi,
Hate maths :) and these setVectors are kickin my arse.
I'm capturing a missile at launch and I just want to add a little upward tilt to it as it launches ....
Code so far;
_missobj Setvelocity [0,0,0];
_missobj SetDir ((getDir _ship)+10);
_missobj SetPos (_ship ModelToWorld [2.2,-7.7,1.8]);
Now how do I just tilt the nose of the missile up just 10-15deg ?
Don't need any long winded functions, the angle won't change.
-
I think this correct:
http://community.bistudio.com/wiki/setVectorDir (http://community.bistudio.com/wiki/setVectorDir)
_p = vectorDir _missobj;
_missobj setVectorDir [(_p select 0), 1, (_p select 2)];
-
Nope .... that didn't do it. Just seem to change its direction in the horizontal plane.
-
G'day, what about the setVectorUp command
_missobj setVectorUp [0.001,0.001,1];
Not sure if it is right my maths is crap, hehe I never made it past year 10 :whistle:
-
Thanks Odin, but it doesnt seem to do anything.
-
Setvectorup works as follows, the direction specified goes up.
So [0,0,1] (max Z) is sitting flat,
[0,1,0] is balancing on the nose of the vehicle,
[1,0,0] is resting on the righthand side.
So, using trig we find your 10-15 degrees as .173648177-.258819045.
This this means if your missile lies down when spawned type :
setvectorup [0,.17365,1] for 10 degrees or
setvectorup [0,.25882,1] for 15 degrees.
Setvectordir I have no idea about.
Luke
-
Try something like this:
_climb = 45; // Initial elevation
_dir = (getDir _ship)+10; // Initial direction
_vz = (sin _climb);
_vh = (cos _climb);
_vx = (sin _dir)*_vh;
_vy = (cos _dir)*_vh;
_missile setVectorDir[_vx, _vy, _vz];
_uz = sin(_climb+90);
_ur = cos(_climb+90);
_ux = sin(_dir)*_ur;
_uy = cos(_dir)*_ur;
_missile setVectorUp[_ux, _uy, _uz];
-
... just got back from travelin again :(
Thanks Mandoble ... works perfect
-
Hey Mandoble, how about a similar situation, except I want to tilt left or right.
ie I want to tilt (Roll) a object X deg left to right, no nose up (pitch) adjustment needed.
Sorry ... my memory of trig is gooone !
-
Try with this (http://www.ofpec.com/forum/index.php?topic=29432.0).
-
Forgot about that gem from Mr Flea. Works a treat thanks Mandoble