Refined the range card calculation abort conditions

* Max. elevation now never exceeds 40 MRADs
* Min. velocity now also depends bullet stability (e.g. lower for .408 CheyTac)
This commit is contained in:
ulteq 2016-11-13 19:13:51 +01:00 committed by ulteq
parent 16f3f2ca37
commit 9fdf3ceb00
2 changed files with 11 additions and 8 deletions

View File

@ -17,8 +17,9 @@
* 11: ballistic coefficient <NUMBER>
* 12: drag model <NUMBER>
* 13: atmosphere model <STRING>
* 14: Range Card Slot <NUMBER>
* 15: Use advanced ballistics config? <BOOL>
* 14: transonicStabilityCoef <NUMBER>
* 15: Range Card Slot <NUMBER>
* 16: Use advanced ballistics config? <BOOL>
*
* Return Value:
* Nothing
@ -33,7 +34,7 @@ params [
"_scopeBaseAngle", "_boreHeight", "_airFriction", "_muzzleVelocity",
"_temperature", "_barometricPressure", "_relativeHumidity", "_simSteps",
"_windSpeed", "_targetSpeed", "_targetRange", "_bc", "_dragModel", "_atmosphereModel",
"_rangeCardSlot", "_useABConfig"
"_transonicStabilityCoef", "_rangeCardSlot", "_useABConfig"
];
GVAR(rangeCardDataMVs) set [_rangeCardSlot, format[" %1", round(_muzzleVelocity)]];
@ -96,8 +97,7 @@ while {_TOF < 6 && (_bulletPos select 1) < _targetRange} do {
_stepsTotal = _stepsTotal + 1;
_speedAverage = (_speedTotal / _stepsTotal);
if (_speedAverage > 450 && _bulletSpeed < _speedOfSound) exitWith {};
if (atan((_bulletPos select 2) / (abs(_bulletPos select 1) + 1)) < -2.254) exitWith {};
if (_transonicStabilityCoef < 1.0 && _speedAverage > 450 && _bulletSpeed < _speedOfSound) exitWith {};
_trueVelocity = _bulletVelocity vectorDiff [-_windSpeed, 0, 0];
_trueSpeed = vectorMagnitude _trueVelocity;
@ -115,6 +115,8 @@ while {_TOF < 6 && (_bulletPos select 1) < _targetRange} do {
_bulletPos = _bulletPos vectorAdd (_bulletVelocity vectorMultiply (_deltaT * 0.5));
_bulletVelocity = _bulletVelocity vectorAdd (_bulletAccel vectorMultiply _deltaT);
_bulletPos = _bulletPos vectorAdd (_bulletVelocity vectorMultiply (_deltaT * 0.5));
if (atan((_bulletPos select 2) / (abs(_bulletPos select 1) + 1)) < -2.254) exitWith {};
_TOF = _TOF + _deltaT;

View File

@ -21,7 +21,7 @@
disableSerialization;
#define __dsp (uiNamespace getVariable "RangleCard_Display")
private ["_airFriction", "_ammoConfig", "_atmosphereModel", "_barrelLength", "_barrelTwist", "_bc", "_boreHeight", "_cacheEntry", "_column", "_control", "_dragModel", "_i", "_muzzleVelocity", "_offset", "_row", "_weaponConfig", "_initSpeed", "_initSpeedCoef"];
private ["_airFriction", "_ammoConfig", "_atmosphereModel", "_transonicStabilityCoef", "_barrelLength", "_barrelTwist", "_bc", "_boreHeight", "_cacheEntry", "_column", "_control", "_dragModel", "_i", "_muzzleVelocity", "_offset", "_row", "_weaponConfig", "_initSpeed", "_initSpeedCoef"];
params ["_zeroRange", "_ammoClass", "_magazineClass", "_weaponClass"];
@ -103,6 +103,7 @@ _bc = 0;
if (count (_ammoConfig select 6) > 0) then {
_bc = (_ammoConfig select 6) select 0;
};
_transonicStabilityCoef = _ammoConfig select 4;
_dragModel = _ammoConfig select 5;
_atmosphereModel = _ammoConfig select 8;
_boreHeight = 3.81;
@ -170,10 +171,10 @@ if (isNil {_cacheEntry}) then {
private _mvShift = [_ammoConfig select 9, _x] call EFUNC(advanced_ballistics,calculateAmmoTemperatureVelocityShift);
private _mv = _muzzleVelocity + _mvShift;
[_scopeBaseAngle,_boreHeight,_airFriction,_mv,_x,EGVAR(scopes,zeroReferenceBarometricPressure),EGVAR(scopes,zeroReferenceHumidity),100,4,1,GVAR(rangeCardEndRange),_bc,_dragModel,_atmosphereModel,_forEachIndex,_useABConfig] call FUNC(calculateRangeCard);
[_scopeBaseAngle,_boreHeight,_airFriction,_mv,_x,EGVAR(scopes,zeroReferenceBarometricPressure),EGVAR(scopes,zeroReferenceHumidity),100,4,1,GVAR(rangeCardEndRange),_bc,_dragModel,_atmosphereModel,_transonicStabilityCoef,_forEachIndex,_useABConfig] call FUNC(calculateRangeCard);
} forEach [-15, -5, 5, 10, 15, 20, 25, 30, 35];
} else {
[_scopeBaseAngle,_boreHeight,_airFriction,_muzzleVelocity,15,EGVAR(scopes,zeroReferenceBarometricPressure),EGVAR(scopes,zeroReferenceHumidity),100,4,1,GVAR(rangeCardEndRange),_bc,_dragModel,_atmosphereModel,4,_useABConfig] call FUNC(calculateRangeCard);
[_scopeBaseAngle,_boreHeight,_airFriction,_muzzleVelocity,15,EGVAR(scopes,zeroReferenceBarometricPressure),EGVAR(scopes,zeroReferenceHumidity),100,4,1,GVAR(rangeCardEndRange),_bc,_dragModel,_atmosphereModel,_transonicStabilityCoef,4,_useABConfig] call FUNC(calculateRangeCard);
};
for "_i" from 0 to 9 do {