-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1914 from cre8ivepark/Patch4_Dev_BoundingBoxAppBar
[Dev→master] Bounding Box and App Bar
- Loading branch information
Showing
74 changed files
with
5,297 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
Assets/HoloToolkit-Examples/Input/Readme/README_TwoHandManipulationTest.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Two Hand Manipulation & normal mode Bounding Box | ||
![Two Hand Manipulation](/External/ReadMeImages/MRTK_TwoHandManipulation.jpg) | ||
This example shows how you can make any object interactable with [TwoHandManipulatable script](/Assets/HoloToolkit/Input/Scripts/Utilities/Interactions/TwoHandManipulatable.cs). This script allows for an object to be movable, scalable, and rotatable with one or two hands. You may also configure the script on only enable certain manipulations. The script works with both HoloLens' gesture input and immersive headset's motion controller input. | ||
|
||
**Demo Video**: https://gfycat.com/ColossalEnlightenedAntipodesgreenparakeet | ||
|
||
The example also includes Bounding Box for the normal mode. In normal mode, Bounding Box gives the visual boundary of the object when you interact with the object. You can find this behavior in the cliff house. (Grab and move, rotate, scale with two motion controllers) | ||
|
||
![Bounding Box Normal Mode](/External/ReadMeImages/MRTK_BoundingBoxNormalMode.jpg) | ||
|
||
|
||
### Known issues ### | ||
- Adjust mode Bounding Box and App Bar will be added through different Pull Request. | ||
- In the immersive headset, current input system only shows single pointer cursor. While holding an object with the first controller, pointing and seleting the object with the second controller will activate the manipulation behavior. Multi-pointer cursor visualization will be updated through different Pull Request. | ||
|
||
|
||
### Unity Scene ### | ||
[TwoHandManipulationTest.unity](/Assets/HoloToolkit-Examples/Input/Scenes/TwoHandManipulationTest.unity) | ||
![TwoHandManipulation Scene](/External/ReadMeImages/MRTK_TwoHandManipulationScene.jpg) | ||
|
||
In the Hierarchy panel, you can find multiple objects that have TwoHandManipulatable script under SceneContent. Notice how each example object has a collider on it. The collider defines the 'hittable area' for the manipulatable--grabbing any collidable that is on the script's GameObject or any descendant will activate the script. | ||
|
||
### TwoHandManipulatable Script ### | ||
![TwoHandManipulation Script](/External/ReadMeImages/MRTK_TwoHandManipulationScript.jpg) | ||
|
||
Simply assign TwoHandManipulatable script to any GameObject to make it manipulatable. | ||
The script has several configurable options: | ||
- **HostTransform**: Use this to specify the transform that the scripts manipulates. By default it is the GameObject that this script is on. | ||
- **Bounding Box Prefab**: To visualize the object bounding box, drop the [BoundingBoxBasic.prefab](/Assets/HoloToolkit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab) here. This is optional. | ||
|
||
- **Manipulation Mode**: Specify the enabled manipulations. | ||
|
||
- **Constraint On Rotation**: If rotation is enabled, only rotate on these axes. | ||
|
||
- **One Handed Movement**: Specify whether you can use just one hand to move the object. | ||
|
||
|
||
|
||
### Bounding Box normal mode visualization ### | ||
![BoundingBox Basic Prefab](/External/ReadMeImages/MRTK_BoundingBoxBasicPrefab.jpg) | ||
|
||
|
||
**TwoHandManipulatable** script uses optional [**BoundingBoxBasic prefab**](/Assets/HoloToolkit/UX/Prefabs/BoundingBoxes/BoundingBoxBasic.prefab) to visualize the borders on manipulation interaction. It shows/hides BoundingBoxBasic in **OnManipulationStarted** and **OnManipulationEnded** event. **TwoHandManipulatable** script can work without BoundingBox visualization. Simply don't assign the BoundingBoxBasic prefab in the Inspector panel. | ||
|
9 changes: 9 additions & 0 deletions
9
Assets/HoloToolkit-Examples/Input/Readme/README_TwoHandManipulationTest.md.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
Assets/HoloToolkit-Examples/UX/Readme/README_BoundingBoxGizmoExample.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Bounding Box & App Bar | ||
![Bounding Box](/External/ReadMeImages/MRTK_AppBar_BoundingBox.jpg) | ||
This example scene demonstrates how to make objects manipulatable using [BoundingBoxRig](/Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBoxRig.cs) script. The bounding box is a standard interface for manipulating object in Windows Mixed Reality. Using gizmo on the corners and edges, you can scale or rotate the object. | ||
App Bar provides the button for entering/exiting 'Adjust' mode to enable/disable Bounding Box. For more information please see ['App Bar and Bounding Box'](https://developer.microsoft.com/en-us/windows/mixed-reality/app_bar_and_bounding_box) on Windows Dev Center. | ||
|
||
## Interaction behavior ## | ||
There are two modes in the Bounding Box: Normal mode and Adjust mode. | ||
### Normal mode ### | ||
- Bounding Box is not visible. | ||
- App Bar shows 'Adjust' button | ||
|
||
### Adjust mode ### | ||
- Bounding Box and gizmo is visible | ||
- App Bar shows 'Done' button | ||
|
||
### Demo video ### | ||
https://gfycat.com/TameQuaintGnu | ||
|
||
When you select one of the gizmo, it is highlighted and other gizmos becomes invisible. This visual feedback helps the user to understand which handle is beining interacted with. | ||
|
||
|
||
<img src="/External/ReadMeImages/MRTK_AppBar_BoundingBox_Interaction.jpg" width="600"> | ||
|
||
## Example scene ## | ||
[BoundingBoxExample.unity](/Assets/HoloToolkit-Examples/UX/Scenes/BoundingBoxGizmoExample.unity) | ||
|
||
<img src="/External/ReadMeImages/MRTK_AppBar_BoundingBox_ExampleScene.jpg" width="600"> | ||
|
||
|
||
|
||
## Structure of Bounding Box & App Bar ## | ||
![Bounding Box](/External/ReadMeImages/MRTK_AppBar_BoundingBox_Structure.jpg) | ||
### [BoundingBoxRig script](/Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBoxRig.cs) ### | ||
This script gets added as a Component to a GameObject. An object with this script as a Component will appear with an AppBar floating in front of it. The BoundingBoxRig script creates a rig of corner and mid-edge handles for scaling and rotating an object. The Adjust button in the AppBar turns on and off the rig. This script cooperates with the TwoHandedManipulation script. | ||
|
||
|
||
|
||
### [BoundingBoxGizmoHandle script](/Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBoxGizmoHandle.cs) ### | ||
This script is not used directly. It is already included in the BoundingBoxRig script. It takes care of creating the rotation and scale handles that are used to adjust the Target object. | ||
|
||
|
||
|
||
|
||
### [AppBar](/Assets/HoloToolkit/UX/Scripts/AppBar/AppBar.cs) and [AppBarButton](/Assets/HoloToolkit/UX/Scripts/AppBar/AppBarButton.cs) script ### | ||
AppBar uses [HolographicButton](/Assets/HoloToolkit/UX/Prefabs/Buttons/HolographicButton.prefab) as a template to build a button collection. In default, it includes Show, Hide, Adjust, Done and Remove buttons. Depending on the current mode - Default, Hidden and Manipulation - it controls the visiblity of each button. Based on the number of the buttons, it adjusts the width of the BackgroundBar component. AppBar script has the logic for following user's position in FollowBoundingBox() function. | ||
|
||
|
||
## How to use Bounding Box & App Bar ## | ||
You can enable Bounding Box and App Bar by simply assigning [BoundingBoxRig script](/Assets/HoloToolkit/UX/Scripts/BoundingBoxes/BoundingBoxRig.cs) to any GameObject. **BoundingBoxRig** script contains these items. | ||
- **BoundingBoxBasic prefab** - Visualizes boundary wireframe | ||
- **AppBar prefab** - Constructs App Bar | ||
- **BoundingBoxHandle material** - Default Material for the gizmo | ||
- **BoundingBoxGrabbed material** - Material for the gizmo when it is being interacted | ||
|
||
![BoundingBox Script Setup](/External/ReadMeImages/MRTK_AppBar_BoundingBox_ScriptSetup.jpg) | ||
![BoundingBox Material Setup](/External/ReadMeImages/MRTK_AppBar_BoundingBox_Materials.jpg) | ||
|
||
## Inspector Properties ## | ||
The BoundingBoxRig exposes several properties in the Inspector. 'Flattening' lets you create a BoundingBoxRig that treats the object as if it were flat in one of its dimensions. | ||
|
||
Customization Settings- let you specify custom materials for the Scale cubes and the Rotate spheres. Additionally, you can specify a Material that is used for any selected handle. | ||
|
||
Behavior- These settings effect how the BoundingBoxRig Scales and Rotates the Target object. Rotation Type allows the object to be rotated in either World Coordinates, or Model Coordinates. You can also specify whether rotation occurs by moving the hand or controller, or by rotating a controller. | ||
|
||
## Combining with HandDraggable script ## | ||
Bounding Box with gizmo provides the interface for scaling and rotating object. To make the object movable, you can assign [HandDraggable script](/Assets/HoloToolkit/InputModule/Scripts/Utilities/Interactions/HandDraggable.cs) to the object. With HandDraggable script, you can grab the body of the object and move. You can move object in both normal mode and adjust mode since it does not require the gizmo interface. | ||
|
||
## Combining with TwoHandManipulatable script ## | ||
[TwoHandManipulatable script](/Assets/HoloToolkit/Input/Scripts/Utilities/Interactions/TwoHandManipulatable.cs) allows for an object to be movable, scalable, and rotatable with one or two hands. This script can be combined with BoudningBoxRig script, providing both options for manipulating objects. You can find this interaction behavior in the cliff house. Using two motion controllers and select buttons, you can move/rotate/scale any objects without entering adjust mode. Still you can enter adjust mode by pressing the button on the AppBar and use gizmo to scale/rotate the object. For more detailed information about TwoHandManipulatable script, please refer to the [README file](/Assets/HoloToolkit-Examples/Input/Readme/README_TwoHandManipulationTest.md). | ||
|
||
|
||
## How to add custom buttons to the App Bar ## | ||
You can add additional buttons to the App Bar for other actions. AppBar prefab provides convenient options in the Inspector panel. Find the AppBar prefab in the Project panel and select it. In the Inspector panel, expand **Buttons** section. By modifying the number of **Size** field, you will be able to see the Element populated in the Buttons section. You can specify details such as postion, name and icon texture name. These buttons are using [HolographicButton](/Assets/HoloToolkit/UX/Prefabs/Buttons/HolographicButton.prefab) prefab as a template. HolographicButton is based on [CompoundButton](/Assets/HoloToolkit/UX/Scripts/Buttons/CompoundButton.cs) script series. For more details about CompoundButton, please refer to the [README file of the InteractableObjectExample](/Assets/HoloToolkit-Examples/UX/Readme/README_InteractableObjectExample.md). | ||
|
||
![AppBar Custom Button](/External/ReadMeImages/MRTK_AppBar_BoundingBox_CustomButtons.jpg) | ||
|
9 changes: 9 additions & 0 deletions
9
Assets/HoloToolkit-Examples/UX/Readme/README_BoundingBoxGizmoExample.md.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.