OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: CaptainBravo on 25 Feb 2010, 11:28:12

Title: Anyone good in math here????????? :)
Post by: CaptainBravo 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.
Title: Re: Anyone good in math here????????? :)
Post by: Mandoble 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)]];
Title: Re: Anyone good in math here????????? :)
Post by: CaptainBravo 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.
Title: Re: Anyone good in math here????????? :)
Post by: CaptainBravo on 02 Mar 2010, 18:11:00
Cough Cough .. hmm .. anyone with clairifccation?  :whistle:
Title: Re: Anyone good in math here????????? :)
Post by: hoz 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";