Skip to content

CMCL-1665: confiner 2D dynamic float-to-int scaling#1053

Merged
glabute merged 2 commits intomainfrom
dev/confiner-floattoint-variable-scaling
Apr 4, 2025
Merged

CMCL-1665: confiner 2D dynamic float-to-int scaling#1053
glabute merged 2 commits intomainfrom
dev/confiner-floattoint-variable-scaling

Conversation

@glabute
Copy link
Collaborator

@glabute glabute commented Apr 1, 2025

Purpose of this PR

CMCL-1665: CinemachineConfiner2D stops working when bounding shape is very large

Conversion between float world coords and the fixed point that Clipper expects was suffering when bounding shapes approaceh 1000 units in size. This is because the hardcoded scaling factor was tuned for small bounding shapes and was too precise for large shapes.

The fix was to dynamically adapt the scaling factor, keeping it the same for small shapes, but decreasing it gradually as the shapes got bigger.

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

@glabute glabute requested a review from alexzaranek April 1, 2025 19:33
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 86.20690% with 4 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@fc70572). Learn more about missing BASE report.
Report is 140 commits behind head on main.

Files with missing lines Patch % Lines
com.unity.cinemachine/Runtime/Core/ConfinerOven.cs 86.20% 4 Missing ⚠️

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

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1053   +/-   ##
=======================================
  Coverage        ?   27.33%           
=======================================
  Files           ?      256           
  Lines           ?    28686           
  Branches        ?        0           
=======================================
  Hits            ?     7841           
  Misses          ?    20845           
  Partials        ?        0           
Files with missing lines Coverage Δ
com.unity.cinemachine/Runtime/Core/ConfinerOven.cs 74.62% <86.20%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@alexzaranek alexzaranek left a comment

Choose a reason for hiding this comment

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

Validated that the Confiner now handles larger bounding boxes correctly. Changes looks good.

@glabute glabute merged commit 642f0dd into main Apr 4, 2025
69 checks passed
@glabute glabute deleted the dev/confiner-floattoint-variable-scaling branch April 4, 2025 19:23
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