Fixed aircraft shaking when flying straight#2068
Fixed aircraft shaking when flying straight#2068dldev32 wants to merge 2 commits intoDonBruce64:masterfrom
Conversation
|
@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. |
|
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. |
0dae5de to
09c7a56
Compare
943c49f to
09c7a56
Compare
|
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; |
There was a problem hiding this comment.
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.
No description provided.