Tweak Air to match known data

This commit is contained in:
PabstMirror 2015-04-05 17:37:11 -05:00
parent c768ef65b2
commit 5c5b8f656e
4 changed files with 101 additions and 98 deletions

View File

@ -44,7 +44,7 @@ _wind = [_crosswind, _tailWind, 0];
_gravity = [0,0,-9.8]; _gravity = [0,0,-9.8];
_currentPos = [0,0,0]; _currentPos = [0,0,0];
_muzzleVelocity = _muzzleVelocity * (((_temp + 273.13) / 288.13 - 1) / 30 + 1); _muzzleVelocity = _muzzleVelocity * (((_temp + 273.13) / 288.13 - 1) / 40 + 1);
_currentVelocity = [0, (_muzzleVelocity * cos _angleDeg), (_muzzleVelocity * sin _angleDeg)]; _currentVelocity = [0, (_muzzleVelocity * cos _angleDeg), (_muzzleVelocity * sin _angleDeg)];
_currentTime = 0; _currentTime = 0;

View File

@ -24,6 +24,7 @@ disableSerialization;
PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile); PARAMS_7(_vehicle,_weapon,_muzzle,_mode,_ammo,_magazine,_projectile);
if (!GVAR(airResistanceEnabled)) exitWith {}; if (!GVAR(airResistanceEnabled)) exitWith {};
if (_unit distance ACE_player > 3000) exitWith {false}; // Large enough distance to not simulate any wind deflection. if (_unit distance ACE_player > 3000) exitWith {false}; // Large enough distance to not simulate any wind deflection.
@ -39,13 +40,12 @@ if (isNil QEGVAR(weather,currentTemperature)) then {
//powder effects: //powder effects:
_temperature = EGVAR(weather,currentTemperature); _temperature = EGVAR(weather,currentTemperature);
_newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 30 + 1); _newMuzzleVelocityCoefficent = (((_temperature + 273.13) / 288.13 - 1) / 40 + 1);
systemChat str _newMuzzleVelocityCoefficent;
if (_newMuzzleVelocityCoefficent != 1) then { if (_newMuzzleVelocityCoefficent != 1) then {
_bulletVelocity = velocity _projectile; _bulletVelocity = velocity _projectile;
systemChat format ["Start Vel: %1", _bulletVelocity];
_bulletSpeed = vectorMagnitude _bulletVelocity; _bulletSpeed = vectorMagnitude _bulletVelocity;
_bulletVelocity = (vectorNormalized _bulletVelocity) vectorMultiply (_bulletSpeed * _newMuzzleVelocityCoefficent); _bulletVelocity = (vectorNormalized _bulletVelocity) vectorMultiply (_bulletSpeed * _newMuzzleVelocityCoefficent);
systemChat format ["New Vel: %1", _bulletVelocity];
_projectile setVelocity _bulletVelocity; _projectile setVelocity _bulletVelocity;
_muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift; _muzzleVelocity = _muzzleVelocity + _muzzleVelocityShift;
}; };

View File

@ -20,107 +20,110 @@ switch (true) do {
case ((abs(_muzzleVelocity - 70) < 0.00001) && ((abs(_airFriction - -0.0001) < 0.00001))): { case ((abs(_muzzleVelocity - 70) < 0.00001) && ((abs(_airFriction - -0.0001) < 0.00001))): {
[ [
["100","1493","9","14.0","3.7","0.4","-0.3","0.3","-0.3","-0.0","0.0"], ["100","1493","9","14.0","3.7","0.4","-0.3","0.0","-0.0","-0.0","0.0"],
["150","1438","14","13.9","2.5","0.4","-0.4","0.4","-0.4","-0.1","0.0"], ["150","1438","14","13.9","2.5","0.4","-0.4","0.0","-0.0","-0.1","0.0"],
["200","1381","20","13.8","1.9","0.5","-0.4","0.5","-0.5","-0.1","0.1"], ["200","1381","20","13.8","1.9","0.5","-0.4","0.0","-0.0","-0.1","0.1"],
["250","1321","27","13.6","1.5","0.5","-0.4","0.7","-0.7","-0.1","0.1"], ["250","1321","27","13.6","1.5","0.5","-0.4","0.1","-0.1","-0.1","0.1"],
["300","1256","36","13.3","1.3","0.6","-0.5","0.8","-0.8","-0.1","0.1"], ["300","1256","36","13.3","1.3","0.6","-0.5","0.1","-0.1","-0.1","0.1"],
["350","1183","49","12.9","1.1","0.6","-0.5","0.9","-0.9","-0.1","0.1"], ["350","1183","49","12.9","1.1","0.6","-0.5","0.1","-0.1","-0.1","0.1"],
["400","1097","70","12.4","0.9","0.6","-0.5","1.1","-1.1","-0.2","0.1"], ["400","1097","70","12.4","0.9","0.6","-0.5","0.1","-0.1","-0.2","0.1"],
["450","979","113","11.6","0.8","0.6","-0.5","1.2","-1.2","-0.2","0.2"] ["450","979","113","11.6","0.8","0.6","-0.5","0.1","-0.1","-0.2","0.2"]
] ]
}; };
case ((abs(_muzzleVelocity - 140) < 0.00001) && ((abs(_airFriction - -0.0001) < 0.00001))): { case ((abs(_muzzleVelocity - 140) < 0.00001) && ((abs(_airFriction - -0.0001) < 0.00001))): {
[ [
["250","1527","2","27.2","9.9","2.6","-2.4","0.6","-0.6","-0.3","0.3"], ["250","1527","2","27.2","9.9","2.6","-2.4","0.1","-0.0","-0.3","0.3"],
["300","1512","2","27.2","8.3","2.7","-2.4","0.7","-0.7","-0.4","0.4"], ["300","1512","2","27.2","8.3","2.7","-2.4","0.1","-0.1","-0.4","0.4"],
["350","1497","3","27.1","7.1","2.7","-2.5","0.8","-0.9","-0.5","0.4"], ["350","1497","3","27.1","7.1","2.7","-2.5","0.1","-0.1","-0.5","0.4"],
["400","1482","3","27.1","6.2","2.7","-2.5","1.0","-1.0","-0.5","0.5"], ["400","1482","3","27.1","6.2","2.7","-2.5","0.1","-0.1","-0.5","0.5"],
["450","1467","3","27.0","5.6","2.8","-2.5","1.1","-1.1","-0.6","0.6"], ["450","1467","3","27.0","5.6","2.8","-2.5","0.1","-0.1","-0.6","0.6"],
["500","1451","4","27.0","5.0","2.9","-2.6","1.2","-1.2","-0.6","0.6"], ["500","1451","4","27.0","5.0","2.9","-2.6","0.1","-0.1","-0.6","0.6"],
["550","1436","4","26.9","4.6","2.9","-2.6","1.3","-1.3","-0.7","0.7"], ["550","1436","4","26.9","4.6","2.9","-2.6","0.1","-0.1","-0.7","0.7"],
["600","1420","5","26.8","4.2","3.0","-2.7","1.4","-1.5","-0.8","0.8"], ["600","1420","5","26.8","4.2","3.0","-2.7","0.1","-0.1","-0.8","0.8"],
["650","1404","5","26.8","3.9","3.0","-2.7","1.6","-1.6","-0.9","0.8"], ["650","1404","5","26.8","3.9","3.0","-2.7","0.1","-0.1","-0.9","0.8"],
["700","1388","6","26.7","3.6","3.1","-2.8","1.7","-1.7","-0.9","0.9"], ["700","1388","6","26.7","3.6","3.1","-2.8","0.1","-0.1","-0.9","0.9"],
["750","1372","6","26.6","3.4","3.2","-2.8","1.8","-1.8","-1.0","1.0"], ["750","1372","6","26.6","3.4","3.2","-2.8","0.2","-0.1","-1.0","1.0"],
["800","1355","7","26.5","3.2","3.2","-2.9","1.9","-1.9","-1.1","1.1"], ["800","1355","7","26.5","3.2","3.2","-2.9","0.2","-0.1","-1.1","1.1"],
["850","1338","8","26.4","3.0","3.3","-2.9","2.0","-2.1","-1.1","1.1"], ["850","1338","8","26.4","3.0","3.3","-2.9","0.2","-0.2","-1.1","1.1"],
["900","1321","8","26.2","2.8","3.4","-3.0","2.2","-2.2","-1.2","1.2"], ["900","1321","8","26.2","2.8","3.4","-3.0","0.2","-0.2","-1.2","1.2"],
["950","1303","9","26.1","2.7","3.4","-3.1","2.3","-2.3","-1.3","1.2"], ["950","1303","9","26.1","2.7","3.4","-3.1","0.2","-0.2","-1.3","1.2"],
["1000","1285","10","26.0","2.6","3.5","-3.1","2.4","-2.4","-1.4","1.3"], ["1000","1285","10","26.0","2.6","3.5","-3.1","0.2","-0.2","-1.4","1.3"],
["1050","1266","11","25.8","2.4","3.5","-3.2","2.5","-2.5","-1.4","1.4"], ["1050","1266","11","25.8","2.4","3.5","-3.2","0.2","-0.2","-1.4","1.4"],
["1100","1247","12","25.7","2.3","3.6","-3.3","2.6","-2.7","-1.5","1.4"], ["1100","1247","12","25.7","2.3","3.6","-3.3","0.2","-0.2","-1.5","1.4"],
["1150","1228","13","25.5","2.2","3.7","-3.3","2.7","-2.8","-1.6","1.5"], ["1150","1228","13","25.5","2.2","3.7","-3.3","0.2","-0.2","-1.6","1.5"],
["1200","1207","14","25.3","2.1","3.7","-3.4","2.9","-2.9","-1.7","1.6"], ["1200","1207","14","25.3","2.1","3.7","-3.4","0.2","-0.3","-1.7","1.6"],
["1250","1186","15","25.1","2.0","3.8","-3.4","3.0","-3.0","-1.7","1.7"], ["1250","1186","15","25.1","2.0","3.8","-3.4","0.2","-0.3","-1.7","1.7"],
["1300","1163","17","24.8","1.9","3.8","-3.5","3.1","-3.1","-1.8","1.7"], ["1300","1163","17","24.8","1.9","3.8","-3.5","0.3","-0.3","-1.8","1.7"],
["1350","1140","19","24.6","1.9","3.9","-3.5","3.2","-3.2","-1.9","1.8"], ["1350","1140","19","24.6","1.9","3.9","-3.5","0.3","-0.3","-1.9","1.8"],
["1400","1115","21","24.3","1.8","3.9","-3.6","3.4","-3.4","-1.9","1.9"], ["1400","1115","21","24.3","1.8","3.9","-3.6","0.3","-0.3","-1.9","1.9"],
["1450","1088","24","23.9","1.7","4.0","-3.6","3.5","-3.5","-2.0","1.9"], ["1450","1088","24","23.9","1.7","4.0","-3.6","0.3","-0.3","-2.0","1.9"],
["1500","1060","27","23.6","1.6","4.0","-3.7","3.6","-3.6","-2.1","2.0"], ["1500","1060","27","23.6","1.6","4.0","-3.7","0.3","-0.3","-2.1","2.0"],
["1550","1028","32","23.1","1.5","4.0","-3.7","3.7","-3.7","-2.1","2.1"], ["1550","1028","32","23.1","1.5","4.0","-3.7","0.3","-0.3","-2.1","2.1"],
["1600","991","38","22.6","1.5","4.0","-3.7","3.8","-3.9","-2.2","2.1"], ["1600","991","38","22.6","1.5","4.0","-3.7","0.3","-0.3","-2.2","2.1"],
["1650","947","49","21.9","1.4","4.0","-3.7","3.9","-4.0","-2.3","2.2"], ["1650","947","49","21.9","1.4","4.0","-3.7","0.3","-0.3","-2.3","2.2"],
["1700","888","71","21.0","1.3","3.9","-3.6","4.1","-4.1","-2.3","2.2"] ["1700","888","71","21.0","1.3","3.9","-3.6","0.3","-0.3","-2.3","2.2"]
] ]
}; };
case ((abs(_muzzleVelocity - 200) < 0.00001) && ((abs(_airFriction - -0.0001) < 0.00001))): { case ((abs(_muzzleVelocity - 200) < 0.00001) && ((abs(_airFriction - -0.0001) < 0.00001))): {
[ [
["450","1527","1","37.3","13.4","6.3","-6.0","0.2","-0.2","-1.0","1.0"], ["450","1527","1","37.3","13.4","6.3","-6.0","0.1","-0.1","-1.0","1.0"],
["500","1519","1","37.2","12.1","6.3","-6.0","0.2","-0.2","-1.1","1.1"], ["500","1519","1","37.2","12.1","6.3","-6.0","0.1","-0.1","-1.1","1.1"],
["550","1510","1","37.2","11.0","6.4","-6.0","0.2","-0.2","-1.3","1.2"], ["550","1510","1","37.2","11.0","6.4","-6.0","0.1","-0.1","-1.3","1.2"],
["600","1502","1","37.2","10.1","6.4","-6.1","0.2","-0.2","-1.4","1.3"], ["600","1502","1","37.2","10.1","6.4","-6.1","0.1","-0.1","-1.4","1.3"],
["650","1494","1","37.2","9.4","6.5","-6.1","0.2","-0.3","-1.5","1.4"], ["650","1494","1","37.2","9.4","6.5","-6.1","0.1","-0.1","-1.5","1.4"],
["700","1485","2","37.1","8.7","6.5","-6.2","0.2","-0.3","-1.6","1.5"], ["700","1485","2","37.1","8.7","6.5","-6.2","0.1","-0.1","-1.6","1.5"],
["750","1477","2","37.1","8.2","6.6","-6.2","0.3","-0.3","-1.7","1.6"], ["750","1477","2","37.1","8.2","6.6","-6.2","0.1","-0.1","-1.7","1.6"],
["800","1468","2","37.0","7.7","6.7","-6.3","0.3","-0.3","-1.8","1.8"], ["800","1468","2","37.0","7.7","6.7","-6.3","0.1","-0.1","-1.8","1.8"],
["850","1460","2","37.0","7.2","6.7","-6.3","0.3","-0.3","-2.0","1.9"], ["850","1460","2","37.0","7.2","6.7","-6.3","0.2","-0.1","-2.0","1.9"],
["900","1451","2","37.0","6.8","6.8","-6.4","0.3","-0.3","-2.1","2.0"], ["900","1451","2","37.0","6.8","6.8","-6.4","0.1","-0.2","-2.1","2.0"],
["950","1443","2","36.9","6.5","6.9","-6.4","0.3","-0.4","-2.2","2.1"], ["950","1443","2","36.9","6.5","6.9","-6.4","0.2","-0.2","-2.2","2.1"],
["1000","1434","2","36.9","6.2","6.9","-6.5","0.4","-0.4","-2.3","2.2"], ["1000","1434","2","36.9","6.2","6.9","-6.5","0.2","-0.2","-2.3","2.2"],
["1050","1425","2","36.8","5.9","7.0","-6.6","0.4","-0.4","-2.5","2.3"], ["1050","1425","2","36.8","5.9","7.0","-6.6","0.2","-0.2","-2.5","2.3"],
["1100","1417","3","36.8","5.6","7.1","-6.6","0.4","-0.4","-2.6","2.4"], ["1100","1417","3","36.8","5.6","7.1","-6.6","0.2","-0.2","-2.6","2.4"],
["1150","1408","3","36.7","5.4","7.1","-6.7","0.4","-0.4","-2.7","2.5"], ["1150","1408","3","36.7","5.4","7.1","-6.7","0.2","-0.2","-2.7","2.5"],
["1200","1399","3","36.6","5.2","7.2","-6.7","0.4","-0.4","-2.8","2.7"], ["1200","1399","3","36.6","5.2","7.2","-6.7","0.2","-0.2","-2.8","2.7"],
["1250","1390","3","36.6","5.0","7.3","-6.8","0.4","-0.4","-2.9","2.8"], ["1250","1390","3","36.6","5.0","7.3","-6.8","0.2","-0.2","-2.9","2.8"],
["1300","1381","3","36.5","4.8","7.4","-6.9","0.5","-0.5","-3.0","2.9"], ["1300","1381","3","36.5","4.8","7.4","-6.9","0.2","-0.2","-3.0","2.9"],
["1350","1372","3","36.4","4.6","7.4","-6.9","0.5","-0.5","-3.2","3.0"], ["1350","1372","3","36.4","4.6","7.4","-6.9","0.2","-0.2","-3.2","3.0"],
["1400","1362","4","36.4","4.4","7.5","-7.0","0.5","-0.5","-3.3","3.1"], ["1400","1362","4","36.4","4.4","7.5","-7.0","0.2","-0.3","-3.3","3.1"],
["1450","1353","4","36.3","4.3","7.6","-7.1","0.5","-0.5","-3.4","3.2"], ["1450","1353","4","36.3","4.3","7.6","-7.1","0.2","-0.3","-3.4","3.2"],
["1500","1344","4","36.2","4.2","7.7","-7.1","0.5","-0.5","-3.5","3.4"], ["1500","1344","4","36.2","4.2","7.7","-7.1","0.3","-0.3","-3.5","3.4"],
["1550","1334","4","36.1","4.0","7.7","-7.2","0.6","-0.5","-3.7","3.5"], ["1550","1334","4","36.1","4.0","7.7","-7.2","0.3","-0.3","-3.7","3.5"],
["1600","1324","4","36.0","3.9","7.8","-7.3","0.6","-0.6","-3.8","3.6"], ["1600","1324","4","36.0","3.9","7.8","-7.3","0.3","-0.3","-3.8","3.6"],
["1650","1314","4","35.9","3.8","7.9","-7.3","0.6","-0.6","-3.9","3.7"], ["1650","1314","4","35.9","3.8","7.9","-7.3","0.3","-0.3","-3.9","3.7"],
["1700","1304","5","35.8","3.7","7.9","-7.4","0.6","-0.6","-4.0","3.8"], ["1700","1304","5","35.8","3.7","7.9","-7.4","0.3","-0.3","-4.0","3.8"],
["1750","1294","5","35.7","3.6","8.0","-7.5","0.6","-0.6","-4.2","3.9"], ["1750","1294","5","35.7","3.6","8.0","-7.5","0.3","-0.3","-4.2","3.9"],
["1800","1284","5","35.6","3.5","8.1","-7.6","0.6","-0.7","-4.3","4.0"], ["1800","1284","5","35.6","3.5","8.1","-7.6","0.3","-0.3","-4.3","4.0"],
["1850","1274","5","35.5","3.4","8.2","-7.6","0.7","-0.7","-4.4","4.2"], ["1850","1274","5","35.5","3.4","8.2","-7.6","0.3","-0.3","-4.4","4.2"],
["1900","1263","6","35.4","3.3","8.2","-7.7","0.7","-0.7","-4.5","4.3"], ["1900","1263","6","35.4","3.3","8.2","-7.7","0.3","-0.3","-4.5","4.3"],
["1950","1253","6","35.2","3.2","8.3","-7.8","0.7","-0.7","-4.7","4.4"], ["1950","1253","6","35.2","3.2","8.3","-7.8","0.3","-0.4","-4.7","4.4"],
["2000","1242","6","35.1","3.1","8.4","-7.8","0.7","-0.7","-4.8","4.5"], ["2000","1242","6","35.1","3.1","8.4","-7.8","0.4","-0.3","-4.8","4.5"],
["2050","1231","7","35.0","3.0","8.4","-7.9","0.7","-0.7","-4.9","4.7"], ["2050","1231","7","35.0","3.0","8.4","-7.9","0.4","-0.4","-4.9","4.7"],
["2100","1219","7","34.8","2.9","8.5","-8.0","0.8","-0.7","-5.0","4.8"], ["2100","1219","7","34.8","2.9","8.5","-8.0","0.4","-0.4","-5.0","4.8"],
["2150","1208","7","34.7","2.9","8.5","-8.0","0.8","-0.8","-5.2","4.9"], ["2150","1208","7","34.7","2.9","8.5","-8.0","0.4","-0.4","-5.2","4.9"],
["2200","1196","8","34.5","2.8","8.6","-8.1","0.8","-0.8","-5.3","5.0"], ["2200","1196","8","34.5","2.8","8.6","-8.1","0.4","-0.4","-5.3","5.0"],
["2250","1184","8","34.3","2.7","8.7","-8.2","0.8","-0.8","-5.4","5.1"], ["2250","1184","8","34.3","2.7","8.7","-8.2","0.4","-0.4","-5.4","5.1"],
["2300","1171","9","34.2","2.7","8.7","-8.2","0.8","-0.8","-5.5","5.2"], ["2300","1171","9","34.2","2.7","8.7","-8.2","0.4","-0.4","-5.5","5.2"],
["2350","1158","9","34.0","2.6","8.8","-8.3","0.8","-0.8","-5.7","5.4"], ["2350","1158","9","34.0","2.6","8.8","-8.3","0.4","-0.4","-5.7","5.4"],
["2400","1145","10","33.8","2.5","8.8","-8.3","0.9","-0.8","-5.8","5.5"], ["2400","1145","10","33.8","2.5","8.8","-8.3","0.4","-0.4","-5.8","5.5"],
["2450","1132","10","33.6","2.5","8.9","-8.4","0.9","-0.9","-5.9","5.6"], ["2450","1132","10","33.6","2.5","8.9","-8.4","0.4","-0.4","-5.9","5.6"],
["2500","1118","11","33.3","2.4","8.9","-8.4","0.9","-0.9","-6.0","5.7"], ["2500","1118","11","33.3","2.4","8.9","-8.4","0.5","-0.4","-6.0","5.7"],
["2550","1103","12","33.1","2.4","9.0","-8.5","0.9","-0.9","-6.1","5.8"], ["2550","1103","12","33.1","2.4","9.0","-8.5","0.4","-0.5","-6.1","5.8"],
["2600","1088","13","32.8","2.3","9.0","-8.5","0.9","-0.9","-6.2","5.9"], ["2600","1088","13","32.8","2.3","9.0","-8.5","0.5","-0.4","-6.2","5.9"],
["2650","1072","14","32.6","2.2","9.0","-8.6","0.9","-0.9","-6.4","6.0"], ["2650","1072","14","32.6","2.2","9.0","-8.6","0.5","-0.5","-6.4","6.0"],
["2700","1056","15","32.3","2.2","9.0","-8.6","0.9","-1.0","-6.5","6.1"], ["2700","1056","15","32.3","2.2","9.0","-8.6","0.5","-0.5","-6.5","6.1"],
["2750","1038","16","31.9","2.1","9.1","-8.6","1.0","-1.0","-6.6","6.3"], ["2750","1038","16","31.9","2.1","9.1","-8.6","0.5","-0.5","-6.6","6.3"],
["2800","1020","18","31.6","2.1","9.1","-8.6","1.0","-1.0","-6.7","6.4"], ["2800","1020","18","31.6","2.1","9.1","-8.6","0.5","-0.5","-6.7","6.4"],
["2850","1000","20","31.2","2.0","9.1","-8.6","1.0","-1.0","-6.8","6.5"], ["2850","1000","20","31.2","2.0","9.1","-8.6","0.5","-0.5","-6.8","6.5"],
["2900","978","22","30.8","1.9","9.0","-8.6","1.0","-1.0","-6.9","6.5"], ["2900","978","22","30.8","1.9","9.0","-8.6","0.5","-0.5","-6.9","6.5"],
["2950","954","26","30.3","1.9","9.0","-8.6","1.0","-1.1","-7.0","6.6"], ["2950","954","26","30.3","1.9","9.0","-8.6","0.5","-0.5","-7.0","6.6"],
["3000","927","31","29.7","1.8","8.9","-8.5","1.1","-1.1","-7.1","6.7"], ["3000","927","31","29.7","1.8","8.9","-8.5","0.5","-0.5","-7.1","6.7"],
["3050","894","38","29.0","1.7","8.8","-8.4","1.1","-1.1","-7.2","6.8"], ["3050","894","38","29.0","1.7","8.8","-8.4","0.5","-0.6","-7.2","6.8"],
["3100","849","54","27.9","1.6","8.5","-8.3","1.1","-1.1","-7.2","6.8"] ["3100","849","54","27.9","1.6","8.5","-8.3","0.5","-0.6","-7.2","6.8"]
] ]
}; };
default {systemChat "Error: MuzzleVelocity not found in LUT"; []}; default {
ERROR("MuzzleVelocity not found in LUT");
[]
};
}; };

View File

@ -11,4 +11,4 @@
#include "\z\ace\Addons\main\script_macros.hpp" #include "\z\ace\Addons\main\script_macros.hpp"
#define MK6_82mm_AIR_FRICTION -0.000075 #define MK6_82mm_AIR_FRICTION -0.0001