]> git.mxchange.org Git - flightgear.git/commitdiff
Position and orientation fixes for the sound code, thanks to Tim Moore
authorehofman <ehofman>
Mon, 2 Nov 2009 10:31:42 +0000 (10:31 +0000)
committerTim Moore <timoore@redhat.com>
Mon, 2 Nov 2009 22:30:02 +0000 (23:30 +0100)
src/Main/viewmgr.cxx
src/Model/acmodel.cxx

index 60cfdb4377cb20d102a771b2cde179cde101d508..6dbc5f2ad008e2c39775ac6ce794ae2ab263a490 100644 (file)
@@ -298,14 +298,8 @@ FGViewMgr::update (double dt)
 
   // update audio listener values
   // set the viewer posotion in Cartesian coordinates in meters
-  SGVec3d offs = SGVec3d( loop_view->getXOffset_m(),
-                          loop_view->getYOffset_m(),
-                          loop_view->getZOffset_m());
-  smgr->set_position_offset( offs );
   smgr->set_position_geod( loop_view->getPosition() );
-
-  smgr->set_orientation( loop_view->getViewOrientation(),
-                         loop_view->getViewOrientationOffset() );
+  smgr->set_orientation( loop_view->getViewOrientation() );
 
   // get the model velocity
   SGVec3f velocity = SGVec3f::zeros();
index 3b5ccfb138fa0a041f44fda6395176f91fff32fa..187e27042e356768a256a11a79d9e9a72f6dd84f 100644 (file)
@@ -124,24 +124,23 @@ FGAircraftModel::update (double dt)
   _aircraft->update();
 
   // update model's audio sample values
-  _fx->set_position_geod( _aircraft->getPosition() );
+  SGGeod position = _aircraft->getPosition();
+  _fx->set_position_geod( position );
 
   SGQuatd orient = SGQuatd::fromYawPitchRollDeg(_heading->getDoubleValue(),
                                                 _pitch->getDoubleValue(),
                                                 _roll->getDoubleValue());
   _fx->set_orientation( orient );
  
-#if 0
   SGVec3d vel = SGVec3d( _speed_n->getFloatValue(),
                          _speed_e->getFloatValue(),
                          _speed_d->getFloatValue() );
   if ( vel[0] || vel[1] || vel[2] ) {
-    SGQuatd q(-0.5, -0.5, 0.5, 0.5);
-    _velocity = toVec3f( q.backTransform( vel ) );
+    SGQuatd hlOr = SGQuatd::fromLonLat(position);
+    _velocity = toVec3f( hlOr.backTransform( vel * SG_FEET_TO_METER ) );
   }
   else
       _velocity = SGVec3f::zeros();
-#endif
   _fx->set_velocity( _velocity );
 }