Home   Help Search Login Register  

Author Topic: Just add a little nose up tilt  (Read 1729 times)

0 Members and 1 Guest are viewing this topic.

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Just add a little nose up tilt
« 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.

Offline ModestNovice

  • Members
  • *
Re: Just add a little nose up tilt
« Reply #1 on: 22 Nov 2008, 18:31:24 »
I think this correct:
http://community.bistudio.com/wiki/setVectorDir

Code: [Select]
_p = vectorDir _missobj;
_missobj setVectorDir [(_p select 0), 1, (_p select 2)];
"The road became empty and the people disappeared. The clouds ran away; opened up the sky, and one by one I watched every constellation die."
- Sean "Slug" Daley

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Re: Just add a little nose up tilt
« Reply #2 on: 23 Nov 2008, 01:34:02 »
Nope .... that didn't do it. Just seem to change its direction in the horizontal plane.

Offline Odin

  • Members
  • *
Re: Just add a little nose up tilt
« Reply #3 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:

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Re: Just add a little nose up tilt
« Reply #4 on: 23 Nov 2008, 02:49:39 »
Thanks Odin, but it doesnt seem to do anything.

Offline Luke

  • Members
  • *
  • Thank God! The OFPEC Staff are here!
Re: Just add a little nose up tilt
« Reply #5 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
Pesky Human!!
Wort Wort Wort.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Just add a little nose up tilt
« Reply #6 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];

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Re: Just add a little nose up tilt
« Reply #7 on: 26 Nov 2008, 11:59:52 »
... just got back from travelin again :(
Thanks Mandoble ... works perfect

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Re: Just add a little nose up tilt
« Reply #8 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 !

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Just add a little nose up tilt
« Reply #9 on: 23 Jan 2009, 20:37:44 »
Try with this.

Offline Gnat

  • Addons Depot
  • Former Staff
  • ****
  • I Bite!
    • Gnats
Re: Just add a little nose up tilt
« Reply #10 on: 26 Jan 2009, 06:59:17 »
Forgot about that gem from Mr Flea. Works a treat thanks Mandoble