]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.cxx
Wingman code from Vivian Meazza
[flightgear.git] / src / AIModel / AIBase.cxx
index 28944390218b3edc59e51ae9b4447671bba3bdd5..35be09b9d183f67b01c2256cbefe08249e3b85a2 100644 (file)
@@ -138,6 +138,7 @@ void FGAIBase::update(double dt) {
 void FGAIBase::Transform() {
 
     if (!invisible) {
+        aip.setVisible(true);
         aip.setPosition(pos);
 
         if (no_roll)
@@ -146,6 +147,9 @@ void FGAIBase::Transform() {
             aip.setOrientation(roll, pitch, hdg);
 
         aip.update();
+    } else {
+        aip.setVisible(false);
+        aip.update();
     }
 
 }
@@ -435,15 +439,7 @@ SGVec3d FGAIBase::getCartPosAt(const SGVec3d& _off) const {
 }
 
 SGVec3d FGAIBase::getCartPos() const {
-    // Transform that one to the horizontal local coordinate system.
-    SGQuatd hlTrans = SGQuatd::fromLonLat(pos);
-
-    // and postrotate the orientation of the AIModel wrt the horizontal
-    // local frame
-    hlTrans *= SGQuatd::fromYawPitchRollDeg(hdg, pitch, roll);
-
     SGVec3d cartPos = SGVec3d::fromGeod(pos);
-
     return cartPos;
 }
 
@@ -470,6 +466,12 @@ void FGAIBase::_setLatitude ( double latitude )  {
     pos.setLatitudeDeg(latitude);
 }
 
+void FGAIBase::_setUserPos(){
+    userpos.setLatitudeDeg(manager->get_user_latitude());
+    userpos.setLongitudeDeg(manager->get_user_longitude());
+    userpos.setElevationM(manager->get_user_altitude() * SG_FEET_TO_METER);
+}
+
 void FGAIBase::_setSubID( int s ) {
     _subID = s;
 }
@@ -586,6 +588,18 @@ double FGAIBase::_getHeading() const {
     return hdg;
 }
 
+double  FGAIBase::_getXOffset() const {
+    return _x_offset;
+}
+
+double  FGAIBase::_getYOffset() const {
+    return _y_offset;
+}
+
+double  FGAIBase::_getZOffset() const {
+    return _z_offset;
+}
+
 const char* FGAIBase::_getPath() const {
     return model_path.c_str();
 }
@@ -606,7 +620,6 @@ const char* FGAIBase::_getSubmodel() const {
     return _submodel.c_str();
 }
 
-
 void FGAIBase::CalculateMach() {
     // Calculate rho at altitude, using standard atmosphere
     // For the temperature T and the pressure p,