Hi guys,
All i can read here was very instructive.
I'm back on this post after a lot of tests around
modelToWorld which can effectively replace the getRelPos function.
However i have to explain what i'm trying to do.
The main goal seems to be crazy because i just try to make a script to stop the back rotor of a UH60 to simulate a happening failure.
The only way i found was to create some bullets close to the rotor to make a local damage.
To make it i used maths given by Spooner in another topic talking about a Claymore mine simulation.
Here's my script.
BRfailure.sqf
//_heli = _this select 0;
_heli = vehicle player;
rotordead = false;
_HEid = _heli addEventHandler ["dammaged",
{
if((_this select 1)=="mala vrtule"and(_this select 2)==1)then{rotordead=true};
hint format ["s0: %1\ns1: %2\ns2: %3",_this select 0,_this select 1,_this select 2]
}];
sleep 0.5;
_spd = 1100;
for [{_lp=0},{_lp<5},{_lp=_lp+1}] do
{
_pos = _heli modelToWorld [1,-7.9,0.95];
_hAngle = (direction _heli) + 270;
_vAngle = asin ((vectorDir _heli) select 2);
_vel = [(sin _hAngle)*(cos _vAngle)*_spd,(cos _hAngle)*(cos _vAngle)*_spd,(sin _vAngle)*_spd];
_bullet = "B_127x99_Ball_noTracer" createvehicle _pos;
_bullet setVectorDir _vel;
_bullet setVelocity _vel;
sleep 0.1;
if (rotordead) then {_lp=5};
};
_heli removeEventHandler ["Dammaged",_HEid];
This script works but not perfectly. I think the problem comes from the line
_vAngle = asin ((vectorDir _heli) select 2); which makes the axe of the bullet not always correct depending the pitch and inclination of the chopper.
My problem is that my math level is extremly low. And i often do not understand what i copy and paste.
You'd be great to help me to correct this axe.