]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIMultiplayer.cxx
Ground network distance tracking code. AIAircraft taxiing at airports
[flightgear.git] / src / AIModel / AIMultiplayer.cxx
index e4bb79176aeaf42feb6ce87727a2cde379d1ba1f..e7a3abd47eaad07591e9d7662dc27c75930c00ab 100755 (executable)
@@ -172,6 +172,7 @@ void FGAIMultiplayer::update(double dt)
 
   SGVec3d ecPos;
   SGQuatf ecOrient;
+
   if (tInterp <= curentPkgTime) {
     // Ok, we need a time prevous to the last available packet,
     // that is good ...
@@ -184,6 +185,7 @@ void FGAIMultiplayer::update(double dt)
       MotionInfo::iterator firstIt = mMotionInfo.begin();
       ecPos = firstIt->second.position;
       ecOrient = firstIt->second.orientation;
+      speed = norm(firstIt->second.linearVel) * SG_METER_TO_NM * 3600.0;
 
       std::vector<FGFloatPropertyData>::const_iterator firstPropIt;
       std::vector<FGFloatPropertyData>::const_iterator firstPropItEnd;
@@ -217,6 +219,8 @@ void FGAIMultiplayer::update(double dt)
       ecPos = ((1-tau)*prevIt->second.position + tau*nextIt->second.position);
       ecOrient = interpolate((float)tau, prevIt->second.orientation,
                              nextIt->second.orientation);
+      speed = norm((1-tau)*prevIt->second.linearVel
+                   + tau*nextIt->second.linearVel) * SG_METER_TO_NM * 3600.0;
 
       if (prevIt->second.properties.size()
           == nextIt->second.properties.size()) {
@@ -277,6 +281,8 @@ void FGAIMultiplayer::update(double dt)
       t -= h;
     }
 
+    speed = norm(linearVel) * SG_METER_TO_NM * 3600.0;
+
     std::vector<FGFloatPropertyData>::const_iterator firstPropIt;
     std::vector<FGFloatPropertyData>::const_iterator firstPropItEnd;
     firstPropIt = it->second.properties.begin();
@@ -292,7 +298,8 @@ void FGAIMultiplayer::update(double dt)
   
   // extract the position
   pos = SGGeod::fromCart(ecPos);
-  
+  altitude_ft = pos.getElevationFt();
+
   // The quaternion rotating from the earth centered frame to the
   // horizontal local frame
   SGQuatf qEc2Hl = SGQuatf::fromLonLatRad((float)pos.getLongitudeRad(),