-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Partial fix for BoundsControl collider issues and inconsistency #9973
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Assets/MRTK/SDK/Features/UX/Scripts/BoundsControl/Visuals/PerAxisHandles.cs
Outdated
Show resolved
Hide resolved
Could we add a test with a strangely shaped collider as an additional scenario to cover? |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
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.
Approved for the bug fix itself, but definitely echoing @CDiaz-MS's request
Could we add a test with a strangely shaped collider as an additional scenario to cover?
Do we want this test before we merge? |
@davidkline-ms Yes, I'll add the test tomorrow morning. Should be quick. |
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.
Approved pending addition of new test
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Partial fix for BoundsControl collider issues and inconsistency
Partial fix for BoundsControl collider issues and inconsistency
Partial fix for BoundsControl collider issues and inconsistency
Partial fix for BoundsControl collider issues and inconsistency
Partial fix for BoundsControl collider issues and inconsistency
Overview
Currently,
BoundsControl
has several issues and inconsistencies regarding the handles and activation mechanisms. This PR is the first in a series to address these problems.This PR adjusts how the colliders on the per-axis handles are constructed and aligned, resolving the collider alignment issues for the rotate and translate handle types only. Currently, scale handles are a different type of Handle entirely, and this PR will not resolve scale handle collider issues. A future PR will address those issues.
BoundsControl
constructs a container transform for each handle and an accompanying child transform which holds the "visual" of the handle. This separation allowsBoundsControl
to independently scale the handle visual without affecting the collider, which improves reliability and collision detection. (Scaling of the handle is necessary forProximityEffect
and the "grow" animation that triggers on proximity.) However, this separation induces an issue where per-axis handle visuals are rotated to fit the object, but the colliders cannot be rotated to match their visual counterparts. (Colliders are axis-alignedBounds
, and therefore cannot be rotated easily).Originally, these container transforms that held the colliders would not be rotated, but the underlying visual object would be rotated. To solve the issue of not being able to rotate the axis-aligned colliders, this PR revises the handle construction code to instead rotate the container transform, and leave the handle visual un-rotated. By letting the container transform perform the rotation instead of the visual, the collider remains properly aligned with the handle visual.
Old: the handle is rotated separately from the collider, causing misalignment:
New: the transform container performs the rotation, keeping the collider aligned:
Included in this PR is also several amendments to variable naming schemes and inline comments/doccomments. Due to a previous refactor, the
PerAxisHandles
class was previously exclusively used for rotation handles. This PR removes several instances of comments/variables referring exclusively to rotation affordances.A TODO is marked to fix a hard-coded cursor icon issue. A future PR in this series will resolve that as well.
This PR partially solves #9946, but requires additional PRs to cover all functionalities affected by this issue (including scale handles!)
Changes
PerAxisHandles
to more accurately and consistently reflect the current usageVisualUtils
so thatGetMaxComponent
is always used to determine handle size, rather than an arbitrary axisVerification
Existing BoundsControl tests cover this functionality, but they previously passed due to the margin of error/tolerance in the test case. Tighter test tolerances, in my opinion, are not strictly necessary. The issue this solves is more visible with larger/more strangely shaped colliders, as seen in the linked issue.