CMCL-1583: fix camera update logic, brain update modes sample
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
- Camera only update once per frame: either Render frame or Physics frame, depending on the update mode of the brain. If Smart Update, then camera update time for each camera will depend on the update method of the camera's target.
- Camera targets are 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
- [x] Passed all automated tests
- [x] Manually tested
Documentation status
- [x] Updated CHANGELOG
- [ ] Updated README (if applicable)
- [ ] Commented all public classes, properties, and methods
- [ ] Updated user documentation
Technical risk
low
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.
:exclamation: 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 :warning: |
| ...ty.cinemachine/Runtime/Core/CameraUpdateManager.cs | 93.33% | 2 Missing :warning: |
:exclamation: 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
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
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)