BahamutoD / BDArmory

Gun turrets and other weapon systems for KSP
38 stars 112 forks source link

dragAccel set in BDAirspeedControl.MaxEngineAccel() can be positive #46

Open RichardDastardly opened 8 years ago

RichardDastardly commented 8 years ago

Tested under FAR and a late 10.4/KSP 1.0.5 version ( as I've been chasing this for a while ):

Issue showed mainly during zoom climb during extend mode when DefaultAltitude is set fairly high - the actual issue is that the craft rolls off the throttle completely while pitched up steeply, which can even result in a stall. Spraying debugging labels showed the issue was caused by +ve figures for dragAccel - I am assuming this is never meant to be positive? - set in BDAirspeedControl.MaxEngineAccel() - clamping that number to <=0 fixed the overall issue with no apparent side-effects so far, but I lack the understanding of intent ( and Unity ) to find the root cause currently.

Example of problem from https://youtu.be/RpM0SxN9aNQ?t=113 onwards.

RichardDastardly commented 8 years ago

From what I can make out you're comparing the estimated absolute acceleration of the craft with it's current acceleration along it's velocity vector - but you're not allowing for the current acceleration having a gravity component at the point you produce accelError. Tacking +GravAccel() onto actualCurrentAccel also fixes the issue but it looks a bit messy :p