1
0
Fork 0

another attempt at getting something useful without any result.

This commit is contained in:
ehofman 2009-10-31 14:20:14 +00:00 committed by Tim Moore
parent 9535c4e339
commit d2799cd832
2 changed files with 22 additions and 9 deletions

View file

@ -298,9 +298,16 @@ FGViewMgr::update (double dt)
// update audio listener values // update audio listener values
// set the viewer posotion in Cartesian coordinates in meters // set the viewer posotion in Cartesian coordinates in meters
smgr->set_position( abs_viewer_position ); SGVec3d offs = SGVec3d( loop_view->getXOffset_m(),
smgr->set_orientation(loop_view->getViewOrientation(), loop_view->getYOffset_m(),
loop_view->getViewOrientationOffset()); loop_view->getZOffset_m());
smgr->set_position_offset( offs );
smgr->set_position_geod( loop_view->getPosition() );
SGQuatd orient = SGQuatd::fromYawPitchRollDeg( loop_view->getHeading_deg(),
loop_view->getPitch_deg(),
loop_view->getRoll_deg() );
smgr->set_orientation( orient, loop_view->getViewOrientationOffset() );
// get the model velocity // get the model velocity
SGVec3f velocity = SGVec3f::zeros(); SGVec3f velocity = SGVec3f::zeros();

View file

@ -124,17 +124,23 @@ FGAircraftModel::update (double dt)
_aircraft->update(); _aircraft->update();
// update model's audio sample values // update model's audio sample values
_fx->set_position( _aircraft->getPosition() ); _fx->set_position_geod( _aircraft->getPosition() );
SGQuatd orient = SGQuatd::fromYawPitchRollDeg(_heading->getDoubleValue(), SGQuatd orient = SGQuatd::fromYawPitchRollDeg(-_heading->getDoubleValue(),
_pitch->getDoubleValue(), _pitch->getDoubleValue(),
_roll->getDoubleValue()); _roll->getDoubleValue());
_fx->set_orientation( orient ); _fx->set_orientation( orient );
SGQuatf q(-0.5, -0.5, 0.5, 0.5); SGVec3d vel = SGVec3d( _speed_n->getFloatValue(),
_velocity = q.backTransform( SGVec3f(_speed_n->getFloatValue(),
_speed_e->getFloatValue(), _speed_e->getFloatValue(),
_speed_d->getFloatValue()) ); _speed_d->getFloatValue() );
if ( vel[0] || vel[1] || vel[2] ) {
SGQuatd hlOr = SGQuatd::fromLonLat( _aircraft->getPosition() );
SGQuatd q(-0.5, -0.5, 0.5, 0.5);
_velocity = toVec3f( (hlOr*q).backTransform( vel ) );
}
else
_velocity = SGVec3f::zeros();
_fx->set_velocity( _velocity ); _fx->set_velocity( _velocity );
} }