Fix miscellaneous bugs with camera rotation #2398
Merged
+14
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The EVE clouds were broken.
This is probably because the hemisphere on which clouds are drawn is chosen in the shader based on the position of the planet, which is computed with respect to the galaxy camera, rather than the scaled camera:
https://github.com/rbray89/EnvironmentalVisualEnhancements/blob/0c6fdac386c0fe6da20ddabea25f4fe60ca25b1b/Atmosphere/CloudsPQS.cs#L218-L224.
Normally, both cameras are at the origin, because
ScaledSpace
shifts positions accordingly, so this does not matter; since we adjusted the cameras afterScaledSpace
ran, we moved the scaled space camera (but not the galaxy camera) away from the origin.This may arguably be a bug in EVE (that position should be computed using the scaled space camera, since this is the one that renders), but it is probably a bad idea to violate the KSP invariant.
Run
ScaledSpace.LateUpdate()
by hand.We were updating the scaled space orientation even outside map view.
I am not completely sure whether this had effects or whether the blinking that I experienced was from something else, but scaled space exists in the flight scene too (for distant planets), so we should not mess with it there.
plotting_frame_
is notGetPlottingFrame()
.The C++ was using
plotting_frame_
, which is the last non-target plotting frame, instead ofGetPlottingFrame()
, which is the plotting frame; this meant that, when using the target frame, the camera was following a different frame.