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

CMCL-1583: fix camera update logic, brain update modes sample #981

Merged
merged 4 commits into from
May 9, 2024

Conversation

glabute
Copy link
Collaborator

@glabute glabute commented May 5, 2024

Purpose of this PR

Brain Update Modes sample was broken, indicating deeper problems with the camera update logic.

Problem:
The SmartUpdate window is not smart enough: red car is jittery when it has focus. It gets smooth if you disable the Fixed Update World. Something was wrong with the target tracking: multiple brains interfere with each other somehow.

Solution:

  • Fixed Camera Update logic to better support multiple CM brains in heterogeneous update modes
  • Cm Cameras must only update once per frame: either Render frame or Physics frame, depending on the update mode of the brain. If Smart Update, then update time for each camera will depend on the update method of the camera's target.
  • Camera targets are now updated correctly in the target tracker (once per physics frame, AND once per render frame).
  • BrainUpdateModes sample was tweaked for clarity (help text, camera names)

Testing status

  • Added an automated test
  • Passed all automated tests
  • Manually tested

Documentation status

  • Updated CHANGELOG
  • Updated README (if applicable)
  • Commented all public classes, properties, and methods
  • Updated user documentation

Technical risk

low to medium: need to make sure that all cameras are properly updated in various circumstances

@glabute glabute requested a review from AntoineCharton May 5, 2024 17:30
@glabute glabute requested a review from sebastienduverne as a code owner May 5, 2024 17:30
@codecov-commenter
Copy link

codecov-commenter commented May 5, 2024

Codecov Report

Attention: Patch coverage is 89.58333% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 26.83%. Comparing base (d486b2e) to head (e673f1f).
Report is 2 commits behind head on main.

❗ Current head e673f1f differs from pull request most recent head 9c62f98. Consider uploading reports for the commit 9c62f98 to get more accurate results

Files Patch % Lines
...cinemachine/Runtime/Behaviours/CinemachineBrain.cs 75.00% 3 Missing ⚠️
...ty.cinemachine/Runtime/Core/CameraUpdateManager.cs 93.33% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #981      +/-   ##
==========================================
+ Coverage   26.80%   26.83%   +0.02%     
==========================================
  Files         249      249              
  Lines       27991    27995       +4     
==========================================
+ Hits         7504     7513       +9     
+ Misses      20487    20482       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@AntoineCharton AntoineCharton left a comment

Choose a reason for hiding this comment

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

Under which condition was the jittering happening? Seems to work but I wasn't able to reproduce with 3.1.0.

@glabute
Copy link
Collaborator Author

glabute commented May 9, 2024

Just running the scene, in the smart update window the currently-tracked car should be smooth and the other one jittery (it alternates between the two cars with a sequencer)

@glabute glabute merged commit 5a53a47 into main May 9, 2024
3 of 9 checks passed
@glabute glabute deleted the dev/brain-update-modes-bug branch May 9, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants