BrettRyland / BDArmory

Gun turrets and other weapon systems for KSP
32 stars 23 forks source link

Fix calculation of RCS for FAR wing parts #619

Closed gnustomp closed 4 months ago

gnustomp commented 4 months ago

Casting to the MidChordSweep field to a float causes an InvalidCastException. This results in FAR wings not having any radar return at all, at least according to the RCS analysis tool.

far-wing-bug

By fixing this, the RCS is calculated properly.

far-wing-fix

IIRC, this was a regression in the 1.6.10.0 release.

P.S. I am not a C# or Unity coder, so I'd appreciate a more performant fix.

BrettRyland commented 4 months ago

Looking at FAR, the issue is that the field is a double, not a float, so simply unboxing it as the correct type is sufficient (i.e., 04dd40b8).

gnustomp commented 4 months ago

Can confirm your fix works. Thanks!