From bad5fbf66aaeb52ac189258c18dedbf0d3d25904 Mon Sep 17 00:00:00 2001 From: Torsten Dreyer Date: Wed, 8 Jun 2011 20:17:40 +0200 Subject: [PATCH] Use computed gravity instead of hardcoded value --- src/AIModel/AIBallistic.cxx | 7 ++++--- src/AIModel/AIBallistic.hxx | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AIModel/AIBallistic.cxx b/src/AIModel/AIBallistic.cxx index b3e3bceb5..69e090e3d 100644 --- a/src/AIModel/AIBallistic.cxx +++ b/src/AIModel/AIBallistic.cxx @@ -32,6 +32,7 @@ #include "AIBallistic.hxx" #include
+#include using namespace simgear; @@ -51,7 +52,6 @@ _elapsed_time(0), _aero_stabilised(false), _drag_area(0.007), _life_timer(0.0), -_gravity(32.1740485564), _buoyancy(0), _wind(true), _mass(0), @@ -727,7 +727,7 @@ void FGAIBallistic::Run(double dt) { if ( speed < 0.0 ) speed = 0.0; - double speed_fps = speed * SG_KT_TO_FPS; +// double speed_fps = speed * SG_KT_TO_FPS; // calculate vertical and horizontal speed components calcVSHS(); @@ -858,7 +858,8 @@ void FGAIBallistic::Run(double dt) { hs = 0; // adjust vertical speed for acceleration of gravity, buoyancy, and vertical force - vs -= (_gravity - _buoyancy - v_force_acc_fpss - normal_force_fpss) * dt; + double gravity = Environment::Gravity::instance()->getGravity(pos); + vs -= (gravity - _buoyancy - v_force_acc_fpss - normal_force_fpss) * dt; if (vs <= 0.00001 && vs >= -0.00001) vs = 0; diff --git a/src/AIModel/AIBallistic.hxx b/src/AIModel/AIBallistic.hxx index fb1b4f28d..f798347c9 100644 --- a/src/AIModel/AIBallistic.hxx +++ b/src/AIModel/AIBallistic.hxx @@ -175,7 +175,6 @@ private: bool _aero_stabilised; // if true, object will align with trajectory double _drag_area; // equivalent drag area in ft2 double _life_timer; // seconds - double _gravity; // fps^2 double _buoyancy; // fps^2 bool _wind; // if true, local wind will be applied to object double _Cd; // drag coefficient