After an afternoon's examination, here's my current scheme I'm leaning more heavily toward.
As before, I eliminate the factor of 4 reduction in random aim error applied to AA guns.
For aircraft guns I eliminate the silly algorithm for guns within 0.5m of the vertical plane passing through the longitudinal axis. I retain the rest of the original algorithm, with these changes:
- The final calculation of d4 uses a fixed range for randomizing. The original formula has the range increasing with increasing projectile mass, but the lower limit can get rather small. A uniform randomizer seems to work more predictably. More below...
- I re-introduce my user settable scaling factor, gunSwayFactor, so that the player need not endure all or none of this effect.
As promised with regard to setting a fixed range for randomization when calculating the final value for d4... This change alone has gone some way toward fixing one oddity. Take the Mk.XIV Spitfire, for example, with its pair of .50 HMG and pair of 20mm cannon in the wings. It's long bugged me how the MG induced a significantly greater vibration/sway than did the cannon. This change to the randomizer range has brought the effect of the cannon firing out of the near zero impact to at least approaching the .50 in effect. Other planes with cannon that fire alone have been similarly improved. The 190A-8 is another example.
The first part of Gun.doStartBullet() relevant to the subject at hand:
public void doStartBullet(double d)
{
int i = nextIndexBulletType();
long l = Time.tick() + (long)((double)Time.tickLenFms() * d);
super.pos.getTime(l, loc);
Loc loc1 = loc;
Orient orient;
if(super.prop.maxDeltaAngle > 0.0F)
{
orient = loc.getOrient();
float f = (float)World.Rnd().nextGaussian() * super.prop.maxDeltaAngle * 0.37F * qualityModifier;
f = clampA(f, super.prop.maxDeltaAngle * 3F);
float f1 = (float)World.Rnd().nextGaussian() * super.prop.maxDeltaAngle * 0.173F * qualityModifier;
f1 = clampA(f1, super.prop.maxDeltaAngle * qualityModifier * 2.0F);
// if((this instanceof CannonAntiAirGeneric) || (this instanceof MGunAntiAirGeneric))
// {
// f = (float)((double)f * 0.25D);
// f1 = (float)((double)f1 * 0.25D);
// }
orient.increment(f, f1, 0.0F);
} else
{
orient = loc1.getOrient();
}
v1.set(1.0D, 0.0D, 0.0D);
vWind.set(0.0D, 0.0D, 0.0D);
orient.transform(v1);
v1.scale(super.prop.bullet[i].speed);
Actor actor = getOwner();
if(actor instanceof Aircraft)
{
v2.set(v1);
v2.scale(super.prop.bullet[i].massa * (float)super.prop.bulletsCluster);
((SndAircraft) ((Aircraft)actor)).FM.gunPulse(v2);
actor.getSpeed(v);
v1.add(v);
if(World.cur().diffCur.Wind_N_Turbulence)
{
Point3d point3d = new Point3d();
super.pos.getAbs(point3d);
World.wind().getVectorWeapon(point3d, vWind);
v1.add(-((Tuple3d) (vWind)).x, -((Tuple3d) (vWind)).y, 0.0D);
}
if(actor == World.getPlayerAircraft())
{
World.cur().scoreCounter.bulletsFire += super.prop.bulletsCluster;
if(World.cur().diffCur.Realistic_Gunnery && (((SndAircraft) ((Aircraft)actor)).FM instanceof RealFlightModel))
{
Loc loc2 = super.pos.getRel();
// if(Math.abs(((Tuple3d) (loc2.getPoint())).y) < 0.5D)
// {
// double d1 = super.prop.bullet[i].massa * super.prop.bullet[i].speed;
// v.x = World.Rnd().nextDouble(-20D, 20D) * d1;
// v.y = World.Rnd().nextDouble(-100D, 200D) * d1;
// v.z = World.Rnd().nextDouble(-200D, 200D) * d1;
// v.scale(0.3D);
// ((RealFlightModel)((SndAircraft) ((Aircraft)actor)).FM).gunMomentum(v, false);
// } else
double d2 = super.prop.bullet[i].massa * (float)super.prop.bulletsCluster * super.prop.shotFreq;
v2.set(-1D, 0.0D, 0.0D);
loc2.transform(v2);
double d4 = 0.45D * Math.sqrt(Math.sqrt(super.prop.bullet[i].massa));
// d4 = 64D * World.Rnd().nextDouble(1.0D - d4, 1.0D + d4);
d4 = 64D * World.Rnd().nextDouble(0.8D, 1.2D); //========================
v2.scale(d4 * v1.length() * d2);
v.cross(loc2.getPoint(), v2);
v.y *= 0.1D;
v.z *= 0.5D;
// v.scale(0.3D);
v.scale(0.3D * (double) gunSwayFactor); //gunSwayFactor set in conf.ini; can be 0.1 to 1.0(default) //==========================
((RealFlightModel)((SndAircraft) ((Aircraft)actor)).FM).gunMomentum(v, true);
}
}
} else