Skip to content
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

Use a custom timing to adjust the planetarium camera. #2402

Merged
merged 1 commit into from
Dec 13, 2019

Conversation

eggrobin
Copy link
Member

Fix #2401.

The LateUpdate of the new file is essentially the old OrientPlanetariumCamera. Some of the remainder of the diff is removing workarounds for timing-induced issues; it may be more to compare the adapter with its state prior to #2393: https://github.com/mockingbirdnest/Principia/compare/14ee57622a1064f4518f6f6e1c8c4e3f89cb3fcc...eggrobin:camera-rotation?expand=1#diff-c8666bccb01bd25d11f7ae5e0b5f2d1f.

// Custom timing, 301.
planetarium_camera_adjuster_ =
gameObject.AddComponent<PlanetariumCameraAdjuster>();
planetarium_camera_adjuster_.adapter = this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be set at construction? (Thinking of perfect forwarding, but maybe KSP/Unity/C# are not smart enough.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is discouraged to have constructors on MonoBehaviours (AddComponent constructs by reflection, so a parameterized constructor that takes the adapter is definitely out of the question).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could possibly do some Unity trickery to get it from the parent in Awake or something, to avoid the public mutability, but at that point I am not sure it would improve readability.

@pleroy pleroy added the LGTM label Dec 13, 2019
@eggrobin eggrobin merged commit 42889b6 into mockingbirdnest:master Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calling ScaledSpace LateUpdate in LateUpdate BetterLateThanNever induces timing issues
2 participants