MixedRealityToolkit / MixedRealityToolkit-Unity

This repository holds the third generation of the Mixed Reality Toolkit for Unity. The latest version of the MRTK can be found here.
BSD 3-Clause "New" or "Revised" License
393 stars 103 forks source link

[FEATURE REQUEST] more options for handles #707

Open Daniel4144 opened 6 months ago

Daniel4144 commented 6 months ago

Describe the problem

Unity provides great tools for object movement. Although MRTK also has nice options for creating such handles, I am missing especially one option: The planar handles for two dimensional translation. In my opinion it is often desired to move an object in two dimensions, e.g. ignoring depth or height, which is not possible with the available bounds handles.

Describe the solution you'd like

An additional HandleType 'HandleType.Translation2D' for the BoundsHandleInteractable component to translate in two dimensions.

Describe alternatives you've considered

I have considered using the MoveAxisConstraint for a workaround, but it feels more like a hack than an actual solution considering there is already the BoundsControl with the BoundsHandleInteractables to create handles easily.

Additional context

Unity tool handles: grafik grafik

My custom handles, without the planar translation handle: grafik

An additional option that could be useful is the switch between local/global coordinate manipulation (e.g. to rotate around the global vertical axis), but that is maybe easier to implement externally by simply adjusting the rotation of the handle continuously.

shaynie commented 6 months ago

@Daniel4144, would you like to submit a pull request for your implementation? The community could then review and see them in action.

Daniel4144 commented 6 months ago

@shaynie I can certainly share the custom handle, if you want? But it is not optimized for general use (does not scale well with object size, etc.) and does not contain the suggested planar translation. It's just a very simple alternative to the existing prefab BoundingBoxWithHandles created from existing MRTK components (which are great btw, made it easy to create this).

Daniel4144 commented 6 months ago

I submitted a pull request for the translation handle types (was surprisingly simple to implement).

For maximum flexibility additional handle types for scaling (1D, 2D, 3D) would make sense in my opinion, although I don't need them at the moment.