- // Copy in the existing velocity for now...
- Math::set3(model->getState()->v, s.v);
+ // Velocity
+ string speed_set = fgGetString("/sim/presets/speed-set", "UVW");
+ float v[3];
+ bool needCopy = false;
+ switch (_speed_set) {
+ case NED:
+ v[0] = get_V_north() * FT2M * -1.0;
+ v[1] = get_V_east() * FT2M * -1.0;
+ v[2] = get_V_down() * FT2M * -1.0;
+ break;
+ case UVW:
+ v[0] = get_uBody() * FT2M;
+ v[1] = get_vBody() * FT2M;
+ v[2] = get_wBody() * FT2M;
+ Math::tmul33(s.orient, v, v);
+ break;
+ case KNOTS:
+ v[0] = Atmosphere::spdFromVCAS(get_V_calibrated_kts()/MPS2KTS,
+ pressure, temp);
+ v[1] = 0;
+ v[2] = 0;
+ Math::tmul33(s.orient, v, v);
+ needCopy = true;
+ break;
+ case MACH:
+ v[0] = Atmosphere::spdFromMach(get_Mach_number(), temp);
+ v[1] = 0;
+ v[2] = 0;
+ Math::tmul33(s.orient, v, v);
+ needCopy = true;
+ break;
+ default:
+ v[0] = 0;
+ v[1] = 0;
+ v[2] = 0;
+ break;
+ }
+ if (!copyState)
+ _speed_set = UVW; // change to this after initial setting
+ Math::set3(v, s.v);