From: david Date: Thu, 9 May 2002 21:56:07 +0000 (+0000) Subject: Patch from Melchior Franz: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5c799d1ba27325bcd54937d08d5b48f8bfc5d035;p=flightgear.git Patch from Melchior Franz: It's cumbersome to use the MagicCarpet as 3D cursor, because everytime you shoot over the target you have first to turn by 180 degrees and to fly back. This patch lets the magic carpet fly backwards if brake[0] is active, which is by default associated with the joystick's fire button. --- diff --git a/src/FDM/MagicCarpet.cxx b/src/FDM/MagicCarpet.cxx index 58bf6ec31..738e1e564 100644 --- a/src/FDM/MagicCarpet.cxx +++ b/src/FDM/MagicCarpet.cxx @@ -56,6 +56,10 @@ void FGMagicCarpet::update( int multiloop ) { // speed and distance traveled double speed = globals->get_controls()->get_throttle( 0 ) * 2000; // meters/sec + if ( globals->get_controls()->get_brake( 0 ) ) { + speed = -speed; + } + double dist = speed * time_step; double kts = speed * SG_METER_TO_NM * 3600.0; _set_V_equiv_kts( kts ); @@ -73,7 +77,7 @@ void FGMagicCarpet::update( int multiloop ) { // update (lon/lat) position double lat2, lon2, az2; - if ( speed > SG_EPSILON ) { + if ( fabs( speed ) > SG_EPSILON ) { geo_direct_wgs_84 ( get_Altitude(), get_Latitude() * SGD_RADIANS_TO_DEGREES, get_Longitude() * SGD_RADIANS_TO_DEGREES,