The computation of velocity in src/AIModel/AIBase.cxx (lines 336-339) is most likely wrong since the components do not use the same units:
SGVec3d velocity;
velocity = SGVec3d( speed_north_deg_sec, speed_east_deg_sec,
pitch*speed );
_fx->set_velocity( velocity );
The first 2 components in the SGVec3d constructor are expressed in deg/s while the last one is given in kts*deg.
In addition the members speed_north_deg_sec and speed_east_deg_sec are seldomly updated (the only 2 classes that update them are AIBallistic and AIShip.
Diff:
@colingeniet As one fo the few people that I definitiely know is using AIBallistic: can you confirm for the cases you know of, this would either improve them, or make no difference?
This piece of code only sets the velocity vector for the sound effect, so it should not change anything for the AI models themselves. The 'deg_sec' units seem very suspicious to me.
From this line (
simgear/sound/sample_group.cxx, line 292), I guess the velocity vector is supposed to be in ft/s.So using
_get_speed_{east,north}_fps()and_getVS_fps()would already be better. However the first two usespeed_{east,north}_deg_secinternally, so it won't help if this is not updated.What a mess :) I;d orefer FGFSX::set_velocity used metric already, but deg/sec is particularly weird. Ho hum.
Oh, and
_getVS_fpsis even worse, because it is based on the attributevs, whichAIBaseand I thinkAIAircraftconsider as ft/min, while the rest consider it as ft/sec (or don't update it at all).Oh dear, so many bugs lurking in this code.
Fixing
vsunits: https://sourceforge.net/p/flightgear/flightgear/merge-requests/240/