]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBallistic.cxx
Make sure that takeoff distance calculations are done in the correct frame of referen...
[flightgear.git] / src / AIModel / AIBallistic.cxx
index ccb9371e1c7b4652789bb384c0cd0aaba7ea3f2c..5e3b155095f1dc3147a81dbdbd2d80c7570387c3 100644 (file)
 #  include <config.h>
 #endif
 
-#include <simgear/math/point3d.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/scene/model/modellib.hxx>
 
 #include <Scenery/scenery.hxx>
 
-#include "AIModelData.hxx"
 #include "AIBallistic.hxx"
 
 #include <Main/util.hxx>
@@ -41,30 +39,32 @@ const double FGAIBallistic::slugs_to_kgs = 14.5939029372;
 const double FGAIBallistic::slugs_to_lbs = 32.1740485564;
 
 FGAIBallistic::FGAIBallistic(object_type ot) :
-FGAIBase(ot),
-    _elevation(0),
+    FGAIBase(ot),
+    _height(0.0),
+    _ht_agl_ft(0.0),
+    _azimuth(0.0),
+    _elevation(0.0),
+    _rotation(0.0),
+    _formate_to_ac(false),
     _aero_stabilised(false),
     _drag_area(0.007),
     _life_timer(0.0),
-_gravity(32.1740485564),
+    _gravity(32.1740485564),
     _buoyancy(0),
+    _wind(true),
+    _mass(0),
     _random(false),
-    _ht_agl_ft(0),
     _load_resistance(0),
     _solid(false),
+    _force_stabilised(false),
+    _slave_to_ac(false),
+    _slave_load_to_ac(false),
+    _contents_lb(0),
     _report_collision(false),
     _report_impact(false),
-_wind(true),
+    _external_force(false),
     _impact_report_node(fgGetNode("/ai/models/model-impact", true)),
-    _force_stabilised(false),
-_external_force(false),
-_slave_to_ac(false),
-_slave_load_to_ac(false),
-_formate_to_ac(false),
-_contents_lb(0),
-_mass(0),
-_height(0),
-_old_height(0)
+    _old_height(0)
 
 {
     no_roll = false;
@@ -119,12 +119,6 @@ void FGAIBallistic::readFromScenario(SGPropertyNode* scFileNode) {
     setRandom(scFileNode->getBoolValue("random", false));
 }
 
-osg::Node* FGAIBallistic::load3DModel(const string &path, SGPropertyNode *prop_root)
-{
-  model = SGModelLib::loadModel(path, prop_root, new FGAIModelData(this, prop_root));
-  return model.get();
-}
-
 bool FGAIBallistic::init(bool search_in_AI_path) {
     FGAIBase::init(search_in_AI_path);
 
@@ -434,8 +428,8 @@ void FGAIBallistic::setForcePath(const string& p) {
 
 bool FGAIBallistic::getHtAGL(){
 
-    if (globals->get_scenery()->get_elevation_m(pos.getLatitudeDeg(), pos.getLongitudeDeg(),
-        10000.0, _elevation_m, &_material)){
+    if (getGroundElevationM(SGGeod::fromGeodM(pos, 10000),
+                            _elevation_m, &_material)) {
             _ht_agl_ft = pos.getElevationFt() - _elevation_m * SG_METER_TO_FEET;
             if (_material) {
                 const vector<string>& names = _material->get_names();
@@ -607,7 +601,7 @@ void FGAIBallistic::Run(double dt) {
     //calculate velocity due to external force
     double force_speed_north_deg_sec = 0;
     double force_speed_east_deg_sec = 0;
-    double vs_force_fps = 0;
+//    double vs_force_fps = 0;
     double hs_force_fps = 0;
     double v_force_acc_fpss = 0;
     double force_speed_north_fps = 0;