1
0
Fork 0

new global function for aircraft position

add a new function to get the aircraft's position instead
of reading /position/* properties
This commit is contained in:
Torsten Dreyer 2011-08-20 08:54:47 +02:00
parent 104507ad8b
commit 3fbbe3134a
2 changed files with 15 additions and 0 deletions

View file

@ -37,6 +37,7 @@
#include <simgear/misc/ResourceManager.hxx>
#include <simgear/props/propertyObject.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/scene/model/placement.hxx>
#include <Aircraft/controls.hxx>
#include <Airports/runways.hxx>
@ -362,6 +363,18 @@ FGGlobals::get_event_mgr () const
return event_mgr;
}
const SGGeod &
FGGlobals::get_aircraft_position() const
{
if( acmodel != NULL ) {
SGModelPlacement * mp = acmodel->get3DModel();
if( mp != NULL )
return mp->getPosition();
}
throw sg_exception("Can't get aircraft position", "FGGlobals::get_aircraft_position()" );
}
// Save the current state as the initial state.
void

View file

@ -265,6 +265,8 @@ public:
acmodel = model;
}
const SGGeod & get_aircraft_position() const;
inline FGModelMgr *get_model_mgr () { return model_mgr; }
inline void set_model_mgr (FGModelMgr * mgr)