The stability factor calculation is all metric now

This commit is contained in:
ulteq 2015-05-08 10:46:59 +02:00
parent a8c4068b56
commit fa07110311
2 changed files with 15 additions and 15 deletions

View File

@ -4,10 +4,10 @@
* Calculates the stability factor of a bullet
*
* Arguments:
* 0: caliber - inches <NUMBER>
* 1: bullet length - inches <NUMBER>
* 2: bullet mass - grains <NUMBER>
* 3: barrel twist - inches <NUMBER>
* 0: caliber - mm <NUMBER>
* 1: bullet length - mm <NUMBER>
* 2: bullet mass - grams <NUMBER>
* 3: barrel twist - mm <NUMBER>
* 4: muzzle velocity shift - m/s <NUMBER>
* 5: temperature - degrees celcius <NUMBER>
* 6: barometric Pressure - hPA <NUMBER>
@ -17,7 +17,8 @@
*
* Public: No
*/
#include "script_component.hpp"
private ["_caliber", "_bulletLength", "_bulletMass", "_barrelTwist", "_muzzleVelocity", "_temperature", "_barometricPressure", "_l", "_t", "_stabilityFactor"];
_caliber = _this select 0;
_bulletLength = _this select 1;
@ -31,15 +32,14 @@ _barometricPressure = _this select 6;
_t = _barrelTwist / _caliber;
_l = _bulletLength / _caliber;
_stabilityFactor = 30 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2));
_stabilityFactor = 7587000 * _bulletMass / (_t^2 * _caliber^3 * _l * (1 + _l^2));
_muzzleVelocity = _muzzleVelocity * 3.2808399;
if (_muzzleVelocity > 1120) then {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 2800) ^ (1/3);
if (_muzzleVelocity > 341.376) then {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 853.44) ^ (1/3);
} else {
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 1120) ^ (1/3);
_stabilityFactor = _stabilityFactor * (_muzzleVelocity / 341.376) ^ (1/3);
};
_stabilityFactor = _stabilityFactor * (_temperature + 273) / (15 + 273) * 1013.25 / _barometricPressure;
_stabilityFactor = _stabilityFactor * KELVIN(_temperature) / KELVIN(15) * 1013.25 / _barometricPressure;
_stabilityFactor

View File

@ -91,10 +91,10 @@ if (GVAR(bulletTraceEnabled) && cameraView == "GUNNER") then {
};
};
_caliber = 39.37 * getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_caliber");
_bulletLength = 39.37 * getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_bulletLength");
_bulletMass = 15.432 * getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_bulletMass");
_barrelTwist = 39.37 * getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_barrelTwist");
_caliber = 1000 * getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_caliber");
_bulletLength = 1000 * getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_bulletLength");
_bulletMass = getNumber(configFile >> "cfgAmmo" >> _ammo >> "ACE_bulletMass");
_barrelTwist = 1000 * getNumber(configFile >> "cfgWeapons" >> _weapon >> "ACE_barrelTwist");
_stabilityFactor = 1.5;
if (_caliber > 0 && _bulletLength > 0 && _bulletMass > 0 && _barrelTwist > 0) then {