Use computed gravity instead of hardcoded value
This commit is contained in:
parent
f52cf4e3b8
commit
bad5fbf66a
2 changed files with 4 additions and 4 deletions
src/AIModel
|
@ -32,6 +32,7 @@
|
||||||
#include "AIBallistic.hxx"
|
#include "AIBallistic.hxx"
|
||||||
|
|
||||||
#include <Main/util.hxx>
|
#include <Main/util.hxx>
|
||||||
|
#include <Environment/gravity.hxx>
|
||||||
|
|
||||||
using namespace simgear;
|
using namespace simgear;
|
||||||
|
|
||||||
|
@ -51,7 +52,6 @@ _elapsed_time(0),
|
||||||
_aero_stabilised(false),
|
_aero_stabilised(false),
|
||||||
_drag_area(0.007),
|
_drag_area(0.007),
|
||||||
_life_timer(0.0),
|
_life_timer(0.0),
|
||||||
_gravity(32.1740485564),
|
|
||||||
_buoyancy(0),
|
_buoyancy(0),
|
||||||
_wind(true),
|
_wind(true),
|
||||||
_mass(0),
|
_mass(0),
|
||||||
|
@ -727,7 +727,7 @@ void FGAIBallistic::Run(double dt) {
|
||||||
if ( speed < 0.0 )
|
if ( speed < 0.0 )
|
||||||
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
|
// calculate vertical and horizontal speed components
|
||||||
calcVSHS();
|
calcVSHS();
|
||||||
|
@ -858,7 +858,8 @@ void FGAIBallistic::Run(double dt) {
|
||||||
hs = 0;
|
hs = 0;
|
||||||
|
|
||||||
// adjust vertical speed for acceleration of gravity, buoyancy, and vertical force
|
// 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)
|
if (vs <= 0.00001 && vs >= -0.00001)
|
||||||
vs = 0;
|
vs = 0;
|
||||||
|
|
|
@ -175,7 +175,6 @@ private:
|
||||||
bool _aero_stabilised; // if true, object will align with trajectory
|
bool _aero_stabilised; // if true, object will align with trajectory
|
||||||
double _drag_area; // equivalent drag area in ft2
|
double _drag_area; // equivalent drag area in ft2
|
||||||
double _life_timer; // seconds
|
double _life_timer; // seconds
|
||||||
double _gravity; // fps^2
|
|
||||||
double _buoyancy; // fps^2
|
double _buoyancy; // fps^2
|
||||||
bool _wind; // if true, local wind will be applied to object
|
bool _wind; // if true, local wind will be applied to object
|
||||||
double _Cd; // drag coefficient
|
double _Cd; // drag coefficient
|
||||||
|
|
Loading…
Add table
Reference in a new issue