-
Notifications
You must be signed in to change notification settings - Fork 121
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-1634: decollider would sometimes cause camera to slip inside cracks between adjacent colliders #1033
Conversation
… between adjacent colliders
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1033 +/- ##
==========================================
+ Coverage 26.97% 27.21% +0.24%
==========================================
Files 254 254
Lines 28418 28485 +67
==========================================
+ Hits 7665 7753 +88
+ Misses 20753 20732 -21 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things in Changelog.
style Co-authored-by: Sébastien Duverne <[email protected]>
const int kColliderBufferSize = 10; | ||
static Collider[] s_ColliderBuffer = new Collider[kColliderBufferSize]; | ||
static float[] s_ColliderDistanceBuffer = new float[kColliderBufferSize]; | ||
static int[] s_ColliderOrderBuffer = new int[kColliderBufferSize]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick but would it be possible to avoid instantiating this buffer and instead sort the colliders in distance order directly in the s_ColliderBuffer
? Using Array.Sort(s_ColliderDistanceBuffer, s_ColliderBuffer)
should sort both buffers in the distance order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than that small nitpick, I've tested the changes and the camera decollider now works as expected.
Purpose of this PR
CMCL-1634: decollider would sometimes cause camera to slip inside cracks between adjacent colliders
This is because the collider detection algorithm was inadequate. Algorithm was reworked to be more robust around colliders made up of multiple adjacent colliders. Camera will only go into the crack if the crack is wider than the camera radius specified in the Decollider.
Bonus: smoothing logic was also simplified and corrected, fixing an intermittent bug that caused the camera to sometimes snap out of its smoothed position, bypassing damping. That bug was unreported.
Testing status
Documentation status
Technical risk
low
Comments to reviewers
Please see test scene in the Jira ticket.