Index: AIBase.cxx
===================================================================
RCS file: /var/cvs/FlightGear-0.9/source/src/AIModel/AIBase.cxx,v
retrieving revision 1.89
diff -u -w -b -r1.89 AIBase.cxx
--- AIBase.cxx	22 Jun 2009 21:04:56 -0000	1.89
+++ AIBase.cxx	23 Jun 2009 07:47:09 -0000
@@ -286,7 +286,6 @@
     props->setDoubleValue("controls/flight/target-pitch", pitch);
 
    props->setDoubleValue("controls/flight/target-spd", speed);
-
 }
 
 void FGAIBase::unbind() {
@@ -386,11 +385,19 @@
         if (horiz_offset > 180.0) horiz_offset -= 360.0;
         if (horiz_offset < -180.0) horiz_offset += 360.0;
 
+        //adjust offsets to allow radar to point in direction other than boresight
+        //rotations and elevations are in the local horizontal plane
+        double h_offset = props->getDoubleValue("/sim/controls/radar/h-offset-deg", 0);
+        double v_offset = props->getDoubleValue("/sim/controls/radar/v-offset-deg", 0);
+        double height_offset = props->getDoubleValue("/sim/controls/radar/height-ft",0);
+
+        horiz_offset -= h_offset;
+
         // calculate elevation to target
-        elevation = atan2( altitude_ft - user_altitude, range_ft ) * SG_RADIANS_TO_DEGREES;
+        elevation = atan2( altitude_ft - (user_altitude + height_offset), range_ft ) * SG_RADIANS_TO_DEGREES;
 
         // calculate look up/down to target
-        vert_offset = elevation - user_pitch;
+        vert_offset = elevation - (user_pitch + v_offset);
 
         /* this calculation needs to be fixed, but it isn't important anyway
         // calculate range rate
@@ -411,7 +418,9 @@
         x_shift = range * sin( horiz_offset * SG_DEGREES_TO_RADIANS);
         rotation = hdg - user_heading;
         if (rotation < 0.0) rotation += 360.0;
-        ht_diff = altitude_ft - user_altitude;
+
+        //adjust radar height to allow for position other than ac height
+        ht_diff = altitude_ft - (user_altitude + height_offset);
 
     }
 


