AlignSubtree Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Script to use an independent AlignmentManager to align a specific subtree, independent of the rest of the scene.
public class AlignSubtree : UnityEngine.MonoBehaviour
type AlignSubtree = class
inherit MonoBehaviour
Public Class AlignSubtree
Inherits MonoBehaviour
- Inheritance
-
UnityEngine.MonoBehaviourAlignSubtree
Remarks
The subtree aligned by this will remain world-locked by the independent global world-locking by the WorldLockingManager. This script illustrates how to create and manage an independent AlignmentManager, and apply its alignment to a specific subtree within the scene (the Sub Tree). The global AlignmentManager, owned and managed by the WorldLockingManager, applies its alignment to the global Unity coordinate space (frozen space). The desire here is to use the same Space Pin feature to pin parts of a virtual model (subtree) to the physical world, without affecting global space. To do this requires several steps: 1. Create a new locally owned AlignmentManager (distinct from the one owned by the WorldLockingManager). See Microsoft.MixedReality.WorldLocking.Core.AlignSubtree.CheckInternalWiring. 2. Point the desired SpacePins to use the locally owned AlignmentManager (they default to use the global one). See Microsoft.MixedReality.WorldLocking.Core.AlignSubtree.OnEnable. 3. Use the local AlignmentManager to compute a correction pose, and apply it to the subtree. See Microsoft.MixedReality.WorldLocking.Core.AlignSubtree.Update. On point 2., there are a number of reasonable ways to harvest which SpacePins should use this local AlignmentManager, the method used here, invoking GetComponentsInChildren, is just one such way.
Constructors
AlignSubtree() |
Fields
subTree |
The transform to align. If unset, will align this.transform. |
Properties
AlignmentManager |
Owned independent AlignmentManager. |
CollectFromTree |
Collect all SpacePins from this subtree to manage. |
Orienter |
Optional orienter for implicit orientation SpacePins. If null, will search for it in subtree. |
SaveFileName |
File name for saving to and loading from. Defaults to gameObject's name. Use forward slash '/' for subfolders. |
Methods
AddOwnedPin(SpacePin) |
Explicitly add a pin to the owned pins list. |
ClaimPinOwnership() |
This should be called whenever pins are added to the owned list. |
ClearOwnedPins() |
Clear the entire list of owned space pins. |
Load() |
Explicit command to load the alignment manager from store. |
RemoveOwnedPin(SpacePin) |
Remove a specific pin from the owned pins list. |
Save() |
Explicit command to save the alignment manager to store. |
Events
OnAlignManagerCreated |
Fired when a new AlignmentManager has been created throughout CheckInternalWiring |