-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various NREs. Calculate vessel orientation without using the NavBall, which doesn't exist in IVA mode. #133
Conversation
…all (which doesn't exist in IVA mode).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I've left some comments before merging.
FerramAerospaceResearch/LEGACYferram4/FARControllableSurface.cs
Outdated
Show resolved
Hide resolved
Found another NRE, this time caused by
|
I don't have any ideas why the last NRE is there. Ferram-Aerospace-Research/FerramAerospaceResearch/FARPartGeometry/VehicleVoxel.cs Lines 95 to 106 in 95e127a
used in Ferram-Aerospace-Research/FerramAerospaceResearch/FARAeroComponents/VehicleAerodynamics.cs Line 398 in 95e127a
|
Yet another exception appeared:
I think it needs a
between lines 163 and 164 of FARAeroSection.cs like in the block above it (lines 146-153). |
Good catch, but instead of using |
Ah, I think I see what's going on here.
on lines 428-429 of VehicleVoxel.cs allows this first index to be accessed. Line 398 of VehicleAerodynamics.cs seems to be the only place where |
Changing Ferram-Aerospace-Research/FerramAerospaceResearch/FARAeroComponents/VehicleAerodynamics.cs Line 74 in 95e127a
Array.Empty<VoxelCrossSection>() should work, it's the only place where the contained dict is not created.
|
That would avoid the
? |
I think it's still better than not using anything, at least the old value was valid whereas the new one would blow up the physics due to infinities. |
OK, I think I've fixed all the above points now. The only thing is whether you want to try again to get a quaternion approach to the vessel orientation in PhysicsCalcs.cs or just use the vector algebra. In any case, I'm going to head to bed now. I'll run some more tests tomorrow (SuicidalInsanity is running a new round of BAD-T using FAR, which is the reason I started looking at this in the first place). |
FerramAerospaceResearch/LEGACYferram4/FARControllableSurface.cs
Outdated
Show resolved
Hide resolved
Another exception came up:
This appears to stem from using a forward finite difference to approximate the first derivative on line 1695 of VehicleAerodynamics.cs, where the |
And another exception:
I'm not sure how this one occurs. The only potentially questionable indexing is |
…re the initial CalculateSurfaceFunctions.
You're right, even the two branches are identical.
They look to be updated in the same places so they should always be synced unless there was an exception between updating the two. |
…vative calculation in CalculateSonicPressure.
Are you going to try and fix the last NRE? If not, I'll merge the PR. |
Probably not. I've only seen it once, so it must be fairly rare and I don't really see why it occurred. |
Thanks! |
This fixes the massive performance penalty (see profiling pics) and failure to update the vessel orientation (which likely causes many other issues) in IVA mode caused by a call to
FindObjectOfType<NavBall>()
(which doesn't exist in IVA mode) inGetNavball
(which is being called everyFixedUpdate
since it doesn't find it). It replaces theNavBall
code with explicit calculations of the heading, pitch and roll (which I've checked to be consistent with the values from NavBall to around single precision when not in IVA mode).Additionally, this fixes various
NullReferenceException
s related to EVA kerbals' parachutes and parts that have been destroyed.