mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
more acos fixes
This commit is contained in:
parent
659b5faa07
commit
dab3f72fcb
@ -65,7 +65,7 @@ TRACE_2("searching for new vehicles",_vehicleAdded,_rangeTablesShown);
|
||||
// Some turrets (MK6) have a neutralX rotation that we need to add to min/max config elevation to get actual limits
|
||||
private _weaponDir = _vehicle weaponDirection _weapon;
|
||||
private _turretRot = [vectorDir _vehicle, vectorUp _vehicle, deg _currentTraverseRad] call FUNC(rotateVector3d);
|
||||
private _neutralX = (acos (_turretRot vectorCos _weaponDir)) - (deg _currentElevRad);
|
||||
private _neutralX = (acos ((_turretRot vectorCos _weaponDir) min 1)) - (deg _currentElevRad); // vectorCos can return values outside of -1..1
|
||||
_neutralX = (round (_neutralX * 10)) / 10; // minimize floating point errors
|
||||
private _minElev = _neutralX + getNumber (_turretCfg >> "minElev");
|
||||
private _maxElev = _neutralX + getNumber (_turretCfg >> "maxElev");
|
||||
|
@ -70,7 +70,7 @@ if (_useRealWeaponDir) then {
|
||||
if (isNil "_currentTraverseRad") then { _currentTraverseRad = _vehicle animationPhase _turretAnimBody; };
|
||||
// Get turret roatation around it's z axis, then calc weapon elev in it's projection
|
||||
private _turretRot = [vectorDir _vehicle, vectorUp _vehicle, deg _currentTraverseRad] call FUNC(rotateVector3d);
|
||||
_realElevation = acos (_turretRot vectorDotProduct _weaponDir) + ((_turretRot call CBA_fnc_vect2polar) select 2);
|
||||
_realElevation = (acos ((_turretRot vectorCos _weaponDir) min 1)) + ((_turretRot call CBA_fnc_vect2polar) select 2);
|
||||
if (_realElevation > 90) then { _realElevation = 180 - _realElevation; }; // does not flip azimuth!
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user