X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FYASim%2FYASim.cxx;h=6f0ca2bd6665885428c36d667ef65c561519d9a7;hb=9f73588b31c5fd393e437d672fedd0d8b9cff94b;hp=2f4c9a11168b07e89735491686b6d6ad7a90d49a;hpb=48260480b3be2fea953d51676ea88bb4608a0f96;p=flightgear.git diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index 2f4c9a111..6f0ca2bd6 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -105,10 +105,12 @@ void YASim::init() // Superclass hook common_init(); + m->setCrashed(false); + // Build a filename and parse it SGPath f(globals->get_fg_root()); f.append("Aircraft-yasim"); - f.append(fgGetString("/sim/aircraft")); + f.append(fgGetString("/sim/aero")); f.concat(".xml"); readXML(f.str(), *_fdm); @@ -141,16 +143,19 @@ void YASim::init() } - // Lift the plane up so the gear clear the ground - float minGearZ = 1e18; - for(i=0; inumGear(); i++) { - Gear* g = a->getGear(i); - float pos[3]; - g->getPosition(pos); - if(pos[2] < minGearZ) - minGearZ = pos[2]; + // Are we at ground level? If so, lift the plane up so the gear + // clear the ground + if(get_Altitude() - get_Runway_altitude() < 50) { + float minGearZ = 1e18; + for(i=0; inumGear(); i++) { + Gear* g = a->getGear(i); + float pos[3]; + g->getPosition(pos); + if(pos[2] < minGearZ) + minGearZ = pos[2]; + } + _set_Altitude(get_Runway_altitude() - minGearZ*M2FT); } - _set_Altitude(get_Altitude() - minGearZ*M2FT); // The pilot's eyepoint float pilot[3]; @@ -169,6 +174,10 @@ void YASim::init() bool YASim::update(int iterations) { + // If we're crashed, then we don't care + if(_fdm->getAirplane()->getModel()->isCrashed()) + return true; + int i; for(i=0; igetAGL() * M2FT); // useful conversion matrix float xyz2ned[9]; @@ -390,6 +396,8 @@ void YASim::copyFromYASim() fgg->SetBrake(true); if(g->getCompressFraction() != 0) fgg->SetWoW(true); + else + fgg->SetWoW(false); fgg->SetPosition(g->getExtension()); } @@ -398,6 +406,7 @@ void YASim::copyFromYASim() Thruster* t = model->getThruster(i); fge->set_Running_Flag(true); + fge->set_Cranking_Flag(false); // Note: assumes all tanks have the same fuel density! fge->set_Fuel_Flow(CM2GALS * t->getFuelFlow()