microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

RotationAxisConstraint doesn't work well with BoundsControl #9361

Closed jjimenezg93 closed 9 months ago

jjimenezg93 commented 3 years ago

Describe the bug

RotationAxisConstraint and BoundsControl don't work well together in a number of ways. Link to the suggested solution adopted by UXT is in Additional context.

Examples (see GIFs below too):

  1. If the constraint is configured to allow rotation around X (both in local and world space), the object will only rotate up to a certain degree, then it'll start rotating back. However, when no axes are constrained, you can rotate the object 360º.
  2. If the constraint is configured to rotate around the Z axis in local space, you can roll with any edge handle, but you should only be able to do so with handles on the side edges.
  3. You can configure the component to constrain a single axis, which leads to unexpected rotations.

To reproduce

  1. Go to BoundsControlExamples.
  2. In the scene's hierarchy, click on SceneContent > CoffeeCups and select one of them.
  3. Modify configuration of the RotationAxisConstraint, both Constraint On Rotation and Use Local Space For Constraint.
  4. Play the scene.
  5. Manipulate the actor via BoundsControl and observe how it behaves.
  6. Repeat 3-5 with multiple combinations and you'll see the issues mentioned.

Expected behavior

Assuming that the object was sliced through the center by 3 perpendicular planes, each edge handle should rotate around the plane it's on, unless it must constraint in world space, as the projection of the rotation might lead to a certain rotation on another axis. Also, the configuration shouldn't allow constraining a single axis, as rotating around the other two axes can achieve the same rotation you're trying to restrict.

Screenshots

rotation_axis_constraint_issue

rotation_axis_constraint_issue_2

Your setup (please complete the following information)

Target platform (please complete the following information)

Additional context

We have fixed this in UXT by using swing-twist decomposition (instead of Euler decomposition) in the constraint and slightly modifying how BoundsControl uses it. Still works perfectly fine with Manipulator.

stale[bot] commented 2 years ago

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

Zee2 commented 2 years ago

Un-stale-ing for MRTK3.

IssueSyncBot commented 9 months ago

We appreciate your feedback and thank you for reporting this issue.

Microsoft Mixed Reality Toolkit version 2 (MRTK2) is currently in limited support. This means that Microsoft is only fixing high priority security issues. Unfortunately, this issue does not meet the necessary priority and will be closed. If you strongly feel that this issue deserves more attention, please open a new issue and explain why it is important.

Microsoft recommends that all new HoloLens 2 Unity applications use MRTK3 instead of MRTK2.

Please note that MRTK3 was released in August 2023. It features an all-new architecture for developing rich mixed reality experiences and has a minimum requirement of Unity 2021.3 LTS. For more information about MRTK3, please visit https://www.mixedrealitytoolkit.org.

Thank you for your continued support of the Mixed Reality Toolkit!