From d11e18f9a77e23b673c60c5a1723514b829ad625 Mon Sep 17 00:00:00 2001 From: mfranz Date: Sun, 3 Jun 2007 18:17:05 +0000 Subject: [PATCH] Syd ADAMS: "normalize the radar x and y-shift , 0 to 1.0 based on /instruments/radar/range to make animation simpler" --- src/AIModel/AIBase.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index d837f5699..4c8a24eaa 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -306,8 +306,9 @@ void FGAIBase::unbind() { } double FGAIBase::UpdateRadar(FGAIManager* manager) { - double radar_range_ft2 = fgGetDouble("/instrumentation/radar/range"); bool force_on = fgGetBool("/instrumentation/radar/debug-mode", false); + double radar_range_nm = fgGetDouble("/instrumentation/radar/range"); + double radar_range_ft2 = radar_range_nm; radar_range_ft2 *= SG_NM_TO_METER * SG_METER_TO_FEET * 1.1; // + 10% radar_range_ft2 *= radar_range_ft2; @@ -392,8 +393,8 @@ double FGAIBase::UpdateRadar(FGAIManager* manager) { // horiz_offset += user_yaw; // FIXME: WHY WOULD WE WANT TO ADD IN SIDE-SLIP HERE? // calculate values for radar display - y_shift = range * cos( horiz_offset * SG_DEGREES_TO_RADIANS); - x_shift = range * sin( horiz_offset * SG_DEGREES_TO_RADIANS); + y_shift = (range * cos( horiz_offset * SG_DEGREES_TO_RADIANS)) / radar_range_nm; + x_shift = (range * sin( horiz_offset * SG_DEGREES_TO_RADIANS)) / radar_range_nm; rotation = hdg - user_heading; if (rotation < 0.0) rotation += 360.0; ht_diff = altitude_ft - user_altitude;