Special Aircraft Service

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]   Go Down

Author Topic: Wrestling 'gun sway' under control  (Read 807 times)

0 Members and 1 Guest are viewing this topic.

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: Wrestling 'gun sway' under control
« Reply #12 on: June 23, 2024, 06:48:45 AM »

The calculating of these forces/effects already is limited only to actively firing guns. A damaged/destroyed/empty gun is ignored, as though never there.
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: Wrestling 'gun sway' under control
« Reply #13 on: June 26, 2024, 01:33:37 PM »

After application of Mike's greatly stripped down algorithm, it's now as though gun-induced shake has been completely removed. I have found no weapon set which causes the slightest jiggle. I guess I'll have to check the values of certain variables during run time to see if something has been overlooked...
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: Wrestling 'gun sway' under control
« Reply #14 on: June 26, 2024, 02:14:15 PM »

Food for thought. Here's an example of output I'm directing to log.lst as I check into what's going on, using the A6M2. I've added a random execution of the stock ("old")and Mike's simplified ("NEW") algorithm, selecting to write the values for variables v2 and v for every bullet fired. Because the MGs are mounted close to the centreline v2 is not altered, but v differs by a factor of nearly 21. For the more widely separated wing mounted cannon both v2 and v differ wildly, the former by a factor of almost 600 and the latter by a factor of about 90.


Zero 7.7mm cowl
old v2= (-7.056817923577579, -6.692784854591485, -0.20477036483361605)     v= (38.9662633394331, 48.09037184025043, 213.4432380378075)
NEW v2= (-7.065311749877309, -6.6837460303651515, -0.20709441642098017)     v= (5.36788791488107, -5.443581823426804, -7.4472464317999485)

Zero 20mm MGFF wing
old v2= (-37139.517949441324, 152.04814163987086, -379.53603877479395)     v= (-225.06043997970195, 203.4231499037191, 11419.122934162922)
NEW v2= (-46.7686938896116, -42.92314942590299, -0.054137657328029616)     v= (-7.429061254792006, 8.252026006149887, -124.78289511006068)
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)

WxTech

  • Modder
  • member
  • Offline Offline
  • Posts: 6013
Re: Wrestling 'gun sway' under control
« Reply #15 on: June 26, 2024, 06:25:41 PM »

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:
Code: [Select]
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
Logged
Great minds discuss ideas. Average minds discuss events. Small minds discuss people. - Hyman Rickover (but probably predating his use.)
Pages: 1 [2]   Go Up
 

Page created in 0.037 seconds with 24 queries.