]> git.mxchange.org Git - flightgear.git/commitdiff
Use computed gravity instead of hardcoded value
authorTorsten Dreyer <Torsten@t3r.de>
Wed, 8 Jun 2011 18:17:40 +0000 (20:17 +0200)
committerTorsten Dreyer <Torsten@t3r.de>
Wed, 8 Jun 2011 18:17:40 +0000 (20:17 +0200)
src/AIModel/AIBallistic.cxx
src/AIModel/AIBallistic.hxx

index b3e3bceb55090b0cc3578ca9376e272c2d5f3350..69e090e3d16ae6cd19c1b118c247fef9873b9831 100644 (file)
@@ -32,6 +32,7 @@
 #include "AIBallistic.hxx"
 
 #include <Main/util.hxx>
+#include <Environment/gravity.hxx>
 
 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;
index fb1b4f28d4b411ebbd161b3f5ce17ace1fab78dd..f798347c93c884673d5e958c807eb4cf3b985f10 100644 (file)
@@ -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