OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: Gnat on 22 Nov 2008, 17:31:33

Title: Just add a little nose up tilt
Post 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;
Quote
_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.
Title: Re: Just add a little nose up tilt
Post by: ModestNovice on 22 Nov 2008, 18:31:24
I think this correct:
http://community.bistudio.com/wiki/setVectorDir (http://community.bistudio.com/wiki/setVectorDir)

Code: [Select]
_p = vectorDir _missobj;
_missobj setVectorDir [(_p select 0), 1, (_p select 2)];
Title: Re: Just add a little nose up tilt
Post by: Gnat on 23 Nov 2008, 01:34:02
Nope .... that didn't do it. Just seem to change its direction in the horizontal plane.
Title: Re: Just add a little nose up tilt
Post by: Odin on 23 Nov 2008, 02:13:52
G'day, what about the setVectorUp command

Code: [Select]
_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:
Title: Re: Just add a little nose up tilt
Post by: Gnat on 23 Nov 2008, 02:49:39
Thanks Odin, but it doesnt seem to do anything.
Title: Re: Just add a little nose up tilt
Post by: Luke on 24 Nov 2008, 07:00:47
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
Title: Re: Just add a little nose up tilt
Post by: Mandoble on 24 Nov 2008, 12:06:41
Try something like this:

Code: [Select]
   _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];
Title: Re: Just add a little nose up tilt
Post by: Gnat on 26 Nov 2008, 11:59:52
... just got back from travelin again :(
Thanks Mandoble ... works perfect
Title: Re: Just add a little nose up tilt
Post by: Gnat on 23 Jan 2009, 14:18:19
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 !
Title: Re: Just add a little nose up tilt
Post by: Mandoble on 23 Jan 2009, 20:37:44
Try with this (http://www.ofpec.com/forum/index.php?topic=29432.0).
Title: Re: Just add a little nose up tilt
Post by: Gnat on 26 Jan 2009, 06:59:17
Forgot about that gem from Mr Flea. Works a treat thanks Mandoble