// If no controller mappings found, try to use default interactions.
if(Interactions==null||Interactions.Length<1)
{
SetupDefaultInteractions();
// We still don't have controller mappings, so this may be a custom controller.
if(Interactions==null||Interactions.Length<1)
{
Debug.LogWarning($"No controller interaction mappings found for {controllerType}.");
return;
}
}
// If no profile was found, warn the user. Does not stop the project from running.
if(!profileFound)
{
Debug.LogWarning($"No controller profile found for type {controllerType}; please ensure all controllers are defined in the configured MixedRealityControllerConfigurationProfile.");
/// Sets up the configuration based on the Mixed Reality Controller Mapping Profile.
/// </summary>
[Obsolete("This method is no longer used. Configuration now happens in the constructor. You can check this controller's Enabled property for configuration state.")]
// If the constructor succeeded in finding interactions, Enabled will be true.
returnEnabled;
}
/// <summary>
/// Sets up the configuration based on the Mixed Reality Controller Mapping Profile.
/// </summary>
/// <param name="controllerType">The type this controller represents.</param>
[Obsolete("This method is no longer used. Configuration now happens in the constructor. You can check this controller's Enabled property for configuration state.")]
publicboolSetupConfiguration(TypecontrollerType)
{
// If the constructor succeeded in finding interactions, Enabled will be true.
returnEnabled;
}
/// <summary>
/// Assign the default interactions based on controller handedness, if necessary.
/// </summary>
[Obsolete("The handedness parameter is no longer used. This method now reads from the controller's handedness.")]
/// <param name="registrar">The <see cref="IMixedRealityServiceRegistrar"/> instance that loaded the data provider.</param>
/// <param name="inputSystem">The <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem"/> instance that receives data from this provider.</param>
/// <param name="name">Friendly name of the service.</param>
/// <param name="priority">Service priority. Used to determine order of instantiation.</param>
[System.Obsolete("This constructor is obsolete (registrar parameter is no longer required) and will be removed in a future version of the Microsoft Mixed Reality Toolkit.")]
/// <param name="inputSystem">The <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem"/> instance that receives data from this provider.</param>
/// <param name="name">Friendly name of the service.</param>
/// <param name="priority">Service priority. Used to determine order of instantiation.</param>
Debug.LogError($"Ensure that the prefab '{option.PointerPrefab.name}' listed under Input -> Pointers -> Pointer Options has an {typeof(IMixedRealityPointer).Name} component.\nThis prefab can't be used as a pointer as configured and won't be instantiated.");
/// <param name="spatialAwarenessSystem">The <see cref="SpatialAwareness.IMixedRealitySpatialAwarenessSystem"/> to which the observer is providing data.</param>
/// <param name="name">The friendly name of the data provider.</param>
/// <param name="priority">The registration priority of the data provider.</param>
/// <param name="profile">The configuration profile for the data provider.</param>
/// Default dedicated layer for spatial awareness layer used by most components in MRTK
/// </summary>
publicconstintDefaultSpatialAwarenessLayer=31;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="spatialAwarenessSystem">The <see cref="SpatialAwareness.IMixedRealitySpatialAwarenessSystem"/> to which the observer is providing data.</param>
/// <param name="name">The friendly name of the data provider.</param>
/// <param name="priority">The registration priority of the data provider.</param>
/// <param name="profile">The configuration profile for the data provider.</param>
/// Destroys all observed objects and the observer.
/// </summary>
privatevoidCleanupObservationsAndObserver()
{
Disable();
// Destroys all observed objects and the observer.
ClearObservations();
CleanupObserver();
}
#endregionHelpers
#regionObsolete
/// <summary>
/// Constructor.
/// </summary>
/// <param name="registrar">The <see cref="IMixedRealityServiceRegistrar"/> instance that loaded the observer.</param>
/// <param name="spatialAwarenessSystem">The <see cref="SpatialAwareness.IMixedRealitySpatialAwarenessSystem"/> to which the observer is providing data.</param>
/// <param name="name">The friendly name of the data provider.</param>
/// <param name="priority">The registration priority of the data provider.</param>
/// <param name="profile">The configuration profile for the data provider.</param>
[System.Obsolete("This constructor is obsolete (registrar parameter is no longer required) and will be removed in a future version of the Microsoft Mixed Reality Toolkit.")]
// Minimum distance between the index and the thumb tip required to enter a pinch
privatereadonlyfloatminimumPinchDistance=0.015f;
// Maximum distance between the index and thumb tip required to exit the pinch gesture
privatereadonlyfloatmaximumPinchDistance=0.1f;
// Default enterPinchDistance value
privatefloatenterPinchDistance=0.02f;
/// <summary>
/// The distance between the index finger tip and the thumb tip required to enter the pinch/air tap selection gesture.
/// The pinch gesture enter will be registered for all values less than the EnterPinchDistance. The default EnterPinchDistance value is 0.02 and must be between 0.015 and 0.1.
Debug.LogError("EnterPinchDistance must be between 0.015 and 0.1, please change Enter Pinch Distance in the Leap Motion Device Manager Profile");
}
}
}
// Default exitPinchDistance value
privatefloatexitPinchDistance=0.05f;
/// <summary>
/// The distance between the index finger tip and the thumb tip required to exit the pinch/air tap gesture.
/// The pinch gesture exit will be registered for all values greater than the ExitPinchDistance. The default ExitPinchDistance value is 0.05 and must be between 0.015 and 0.1.
/// <param name="registrar">The <see cref="IMixedRealityServiceRegistrar"/> instance that loaded the data provider.</param>
/// <param name="inputSystem">The <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem"/> instance that receives data from this provider.</param>
/// <param name="name">Friendly name of the service.</param>
/// <param name="priority">Service priority. Used to determine order of instantiation.</param>
[System.Obsolete("This constructor is obsolete (registrar parameter is no longer required) and will be removed in a future version of the Microsoft Mixed Reality Toolkit.")]
/// <param name="inputSystem">The <see cref="Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem"/> instance that receives data from this provider.</param>
/// <param name="name">Friendly name of the service.</param>
/// <param name="priority">Service priority. Used to determine order of instantiation.</param>
Base class for all hand devices, to act be implemented by all backends that want to provide hand input in MRTK. Simulated hands can be used if no hand tracking device is available.
## Simulated hands
Hand input can be simulated in Unity using the "In-Editor Input Simulation" service. This service is enabled by default.
When enabled, virtual left and/or right hands can be moved in the scene using the mouse. Clicking mouse buttons will perform gestures for interacting with objects.
Press shift to control the left hand and/or space to control the right hand. By pressing shift and space simultaneously both hands can be moved at the same time.
The hand simulation has two modes:
1. Quick mode: Hands are shown only as long as they are moved by the mouse. This mode is useful for simple testing of buttons with a single hand.
2. Persistent mode: Hands stay visible on the screen, even if they are not moved. This mode is useful for testing two-hand manipulation and accurate placement. Gestures are toggled on/off by mouse clicks.
The simulation mode can be switched for the left/right hand individually by pressing the T/Y keys respectively.
Detailed settings for hand simulation can be found in the SimulatedHandAPI prefab, which is instantiated through the hand tracking profile. This includes key bindings for hand movement and mouse button bindings for gestures.