From fb0a60b018a8c576535e71cd3b0221d32acc7000 Mon Sep 17 00:00:00 2001 From: ulteq Date: Sat, 28 Oct 2017 10:34:54 +0200 Subject: [PATCH] Gravity correction * ArmA is using 9.8066 --- addons/advanced_ballistics/script_component.hpp | 1 - addons/atragmx/functions/fnc_calculate_solution.sqf | 4 ++-- addons/main/script_macros.hpp | 2 ++ addons/rangecard/functions/fnc_calculateRangeCard.sqf | 2 +- addons/rangecard/functions/script_component.hpp | 2 +- extensions/advanced_ballistics/AdvancedBallistics.cpp | 2 +- extensions/fcs/ace_fcs.cpp | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/advanced_ballistics/script_component.hpp b/addons/advanced_ballistics/script_component.hpp index 48344f8ca3..dafb4150e1 100644 --- a/addons/advanced_ballistics/script_component.hpp +++ b/addons/advanced_ballistics/script_component.hpp @@ -16,7 +16,6 @@ #include "\z\ace\addons\main\script_macros.hpp" -#define GRAVITY 9.80665 #define ABSOLUTE_ZERO_IN_CELSIUS -273.15 #define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS) #define CELSIUS(t) (t + ABSOLUTE_ZERO_IN_CELSIUS) diff --git a/addons/atragmx/functions/fnc_calculate_solution.sqf b/addons/atragmx/functions/fnc_calculate_solution.sqf index a37156de28..a7928d1ef0 100644 --- a/addons/atragmx/functions/fnc_calculate_solution.sqf +++ b/addons/atragmx/functions/fnc_calculate_solution.sqf @@ -58,7 +58,7 @@ private _bulletPos = [0, 0, 0]; private _bulletVelocity = [0, 0, 0]; private _bulletAccel = [0, 0, 0]; private _bulletSpeed = 0; -private _gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -9.80665, cos(_scopeBaseAngle + _inclinationAngle) * -9.80665]; +private _gravity = [0, sin(_scopeBaseAngle + _inclinationAngle) * -GRAVITY, cos(_scopeBaseAngle + _inclinationAngle) * -GRAVITY]; private _deltaT = 1 / _simSteps; private _elevation = 0; @@ -95,7 +95,7 @@ if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) t private _eoetvoesMultiplier = 0; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { - _eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -9.80665) * cos(_latitude) * sin(_directionOfFire); + _eoetvoesMultiplier = 2 * (0.0000729 * _muzzleVelocity / -GRAVITY) * cos(_latitude) * sin(_directionOfFire); }; _bulletPos set [0, 0]; diff --git a/addons/main/script_macros.hpp b/addons/main/script_macros.hpp index 06b9e3ab99..145134d388 100644 --- a/addons/main/script_macros.hpp +++ b/addons/main/script_macros.hpp @@ -109,6 +109,8 @@ #define TRACE_10(MESSAGE,A,B,C,D,E,F,G,H,I,J) /* disabled */ #endif +#define GRAVITY 9.8066 + // Angular unit conversion #define MRAD_TO_MOA(d) ((d) * 3.43774677) // Conversion factor: 54 / (5 * PI) #define MOA_TO_MRAD(d) ((d) * 0.29088821) // Conversion factor: (5 * PI) / 54 diff --git a/addons/rangecard/functions/fnc_calculateRangeCard.sqf b/addons/rangecard/functions/fnc_calculateRangeCard.sqf index 694d234caf..5bb12e220a 100644 --- a/addons/rangecard/functions/fnc_calculateRangeCard.sqf +++ b/addons/rangecard/functions/fnc_calculateRangeCard.sqf @@ -46,7 +46,7 @@ private _bulletPos = [0, 0, 0]; private _bulletVelocity = [0, 0, 0]; private _bulletAccel = [0, 0, 0]; private _bulletSpeed = 0; -private _gravity = [0, sin(_scopeBaseAngle) * -9.80665, cos(_scopeBaseAngle) * -9.80665]; +private _gravity = [0, sin(_scopeBaseAngle) * -GRAVITY, cos(_scopeBaseAngle) * -GRAVITY]; private _deltaT = 1 / _simSteps; private _speedOfSound = 0; if (missionNamespace getVariable [QEGVAR(advanced_ballistics,enabled), false]) then { diff --git a/addons/rangecard/functions/script_component.hpp b/addons/rangecard/functions/script_component.hpp index fdc4a3d486..d4a493206b 100644 --- a/addons/rangecard/functions/script_component.hpp +++ b/addons/rangecard/functions/script_component.hpp @@ -1 +1 @@ -#include "\z\ace\addons\rangecard\script_component.hpp" \ No newline at end of file +#include "\z\ace\addons\rangecard\script_component.hpp" diff --git a/extensions/advanced_ballistics/AdvancedBallistics.cpp b/extensions/advanced_ballistics/AdvancedBallistics.cpp index 1d4ce2d6e9..5760ae797d 100644 --- a/extensions/advanced_ballistics/AdvancedBallistics.cpp +++ b/extensions/advanced_ballistics/AdvancedBallistics.cpp @@ -10,7 +10,7 @@ #define DT_ZERO 0.02 #define DT_SIMULATION 0.005 -#define GRAVITY 9.80665f +#define GRAVITY 9.8066f #define DEGREES(X) (X * 180 / M_PI) #define ABSOLUTE_ZERO_IN_CELSIUS -273.15f #define KELVIN(t) (t - ABSOLUTE_ZERO_IN_CELSIUS) diff --git a/extensions/fcs/ace_fcs.cpp b/extensions/fcs/ace_fcs.cpp index c43b1c227f..8ab57a1c77 100644 --- a/extensions/fcs/ace_fcs.cpp +++ b/extensions/fcs/ace_fcs.cpp @@ -61,7 +61,7 @@ double traceBullet(double initSpeed, double airFriction, double angle, double an posX += velX * simulationStep * 0.5; posY += velY * simulationStep * 0.5; velX += simulationStep * (velX * velMag * airFriction); - velY += simulationStep * (velY * velMag * airFriction - 9.80665); + velY += simulationStep * (velY * velMag * airFriction - 9.8066); posX += velX * simulationStep * 0.5; posY += velY * simulationStep * 0.5; if (posX >= posTargetX) { break; }