Home   Help Search Login Register  

Author Topic: Anyone good in math here????????? :)  (Read 2501 times)

0 Members and 1 Guest are viewing this topic.

Offline CaptainBravo

  • Members
  • *
Anyone good in math here????????? :)
« on: 25 Feb 2010, 11:28:12 »
Hey everyone,

I have been trying different vector commands with no sucsess in getting what I want. I want a bag fence to be facings down (towards ground)

I have managed to get it in all sorts of angles but down facing. Any help with the vectors are highly appreciated.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Anyone good in math here????????? :)
« Reply #1 on: 25 Feb 2010, 12:00:52 »
Code: [Select]
_obj  = your_fence_object;
_angh = getDir _obj; // Desired horizontal direction (current direction of the fence)
_angv = -89; // Desired vertical inclination (inverted)

_angvu = _angv + 90;
_anghu = 0;

if (_angvu > 90) then
{
   _angvu = 90 - _angv;
   _anghu = _angh + 180;
}
else
{
   _anghu = _angh;
};

_obj setVectorDirAndUp [[sin(_angh)*cos(_angv),cos(_angh)*cos(_angv), sin(_angv)], [sin(_anghu)*cos(_angvu),cos(_anghu)*cos(_angvu),sin(_angvu)]];

Offline CaptainBravo

  • Members
  • *
Re: Anyone good in math here????????? :)
« Reply #2 on: 25 Feb 2010, 12:55:44 »
Thanks Mandoble , I appreciate your quick response. I hate to sound like a NooB but how do you use this script?

Is it possible to use the setVectorDirAndUp command or we need script?

this setVectorDirAndUp [[-89, -89, 0],[0, 0, 0]]

Thanks for your help.

Offline CaptainBravo

  • Members
  • *
Re: Anyone good in math here????????? :)
« Reply #3 on: 02 Mar 2010, 18:11:00 »
Cough Cough .. hmm .. anyone with clairifccation?  :whistle:

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: Anyone good in math here????????? :)
« Reply #4 on: 02 Mar 2010, 18:37:31 »
first you need to create the scriptfile  like  myscript.sqf   .. then you need to call the script with something like this..

this execvm "myscript.sqf";
Xbox Rocks