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
6.01k stars 2.12k forks source link

Organize MRTK Content under a MixedRealityContent GameObject #9512

Closed RogPodge closed 3 years ago

RogPodge commented 3 years ago

The problem we are trying to tackle

One of the challenges of creating UI for Mixed Reality is aligning experiences across both AR and VR platforms. Previously, HoloToolkit provided a solution with the SceneContentAdjuster, however, this solution required users to explicitly add monobehaviors to objects they wished to be adjusted, and did not offer much in the way of adjusting user controls/object placement based on experience setting (for example, stationary experiences might expose different controls to the user compared to room scale experiences)

The proposed solution

To address this, I propose introducing a SceneContentSystem with an associated MixedRealityContent Gameobject to the scene. The SceneContentSystem would be used to toggle different features and expose certain parameters for other systems (floorHeight for teleport, targetScale for boundary). while the MixedRealityContent object would provide a dedicated place for users to put their content so that it scales appropriately based on their desired experience. This object would have an equivalent and configurable SceneContentAdjuster monobehavior to accomplish this task.

Basically, if the user wants an element to be placed in the correct position across VR and AR experiences, they would have to make that element a child of the MixedRealityContent object. This would also give MRTK a designated place to spawn relevant UI control objects when adding them in editor.

How would this change affect user experience

In many of the example scenes, we already organize all of the MRTK content (panels, buttons etc.) under a single SceneContent object. This implementation would essentially make it so that when we use the "Add scene and configure" menu option, we instaniate the scene with the MixedRealityToolkit, MixedRealityPlayspace, and a new MixedRealityContent object, encouraging the same sort of gameobject heirarchy as our existing examples.

image

What if the user doesn't want to adhere to the structure?

The user can still instantiate objects outside of this MixedRealityContent object to have those objects stay in the same part of world space regardless of experience. This will result in behavior identical to the current MRTK experience.

They could also create more objects with the SceneContentAdjuster that manage themselves, with the option to link them to the broader SceneContentSystem.

Summary

The main point of the MixedRealityContent object is to guide the users to laying out their content in a certain hierarchy, and to provide a place for us to instantiate new MRTK objects and ensure they are aligned to the user experience settings (the floor height and experience scale)

keveleigh commented 3 years ago

@RogPodge Is this completed after https://github.com/microsoft/MixedRealityToolkit-Unity/pull/9428 and https://github.com/microsoft/MixedRealityToolkit-Unity/pull/9691?

RogPodge commented 3 years ago

yep! closing this now