]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Melchior Franz:
authordavid <david>
Thu, 9 May 2002 21:56:07 +0000 (21:56 +0000)
committerdavid <david>
Thu, 9 May 2002 21:56:07 +0000 (21:56 +0000)
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.

src/FDM/MagicCarpet.cxx

index 58bf6ec31990f815a3483f116e0ef4cd537abc51..738e1e5644de2bad81bd3ae93fbfa250dda1064f 100644 (file)
@@ -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,