Skip to content

Fixed aircraft shaking when flying straight#2068

Open
dldev32 wants to merge 2 commits intoDonBruce64:masterfrom
dldev32:aircraft-shaking-fix
Open

Fixed aircraft shaking when flying straight#2068
dldev32 wants to merge 2 commits intoDonBruce64:masterfrom
dldev32:aircraft-shaking-fix

Conversation

@dldev32
Copy link
Copy Markdown
Contributor

@dldev32 dldev32 commented Mar 29, 2026

No description provided.

@SnailPerson
Copy link
Copy Markdown
Contributor

@dldev32 is this properly tested? What exactly does it do? Vehicle physics are a whacky thing and can f up easily... Ill see what don says but this is my take

@dldev32
Copy link
Copy Markdown
Contributor Author

dldev32 commented Mar 31, 2026

@dldev32 is this properly tested? What exactly does it do? Vehicle physics are a whacky thing and can f up easily... Ill see what don says but this is my take

There's no doubt it works. I made this fix universal, so it will work with any aircraft. It's just that some parts of the code are long outdated and forgotten, leaving behind numerous bugs.

What changed? I simply found a more accurate formula for calculating physics, and it yielded positive results.

If you are against this PR, then just know that this bug will forever remain in mod and will be an eternal obstacle for pilots.

@DonBruce64
Copy link
Copy Markdown
Owner

Not against it. I'm curious, what formula did you use? Just want to double-check the math.

Also @SnailPerson you could very well pull in this branch an test, or have Conman/Nax test since he know how to work with Git branches and aircraft.

@dldev32
Copy link
Copy Markdown
Contributor Author

dldev32 commented Mar 31, 2026

Not against it. I'm curious, what formula did you use? Just want to double-check the math.

Also @SnailPerson you could very well pull in this branch an test, or have Conman/Nax test since he know how to work with Git branches and aircraft.

Aerodynamic damping through the effective moment of inertia.

@dldev32 dldev32 force-pushed the aircraft-shaking-fix branch from 0dae5de to 09c7a56 Compare April 8, 2026 15:58
@dldev32 dldev32 force-pushed the aircraft-shaking-fix branch from 943c49f to 09c7a56 Compare April 8, 2026 16:02
@dldev32
Copy link
Copy Markdown
Contributor Author

dldev32 commented Apr 8, 2026

Done.

if (definition.motorized.isAircraft && !definition.motorized.isBlimp && !hasRotors) {
double q = 0.5 * airDensity * axialVelocity * axialVelocity;
double rollArm = wingSpanVar.currentValue * 0.5 * 0.75;
totalTorque.x /= 1.0 + q * elevatorAreaVar.currentValue * definition.motorized.tailDistance * definition.motorized.tailDistance * 4.0 / momentPitch;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, there's no need to divide the torque by 1 here, that operation doesn't do anything. The more appropriate and faster CPU wise way is this:
totalTorque.x += (q * elevatorAreaVar.currentValue * definition.motorized.tailDistance * definition.motorized.tailDistance * 4.0 / momentPitch);

You may not need the parens, but not sure. I think order of operations PEMDAS stuff makes the maths work right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants