11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License. See LICENSE in the project root for license information.
33
4+ using Microsoft . MixedReality . Toolkit . Core . Definitions . InputSystem ;
45using Microsoft . MixedReality . Toolkit . Core . Definitions . Utilities ;
56using Microsoft . MixedReality . Toolkit . Core . EventDatum . Input ;
67using Microsoft . MixedReality . Toolkit . Core . Interfaces . InputSystem . Handlers ;
@@ -15,6 +16,10 @@ namespace Microsoft.MixedReality.Toolkit.Examples.Demos
1516 /// </summary>
1617 public class SwapVolume : MonoBehaviour , IMixedRealityPointerHandler
1718 {
19+ [ SerializeField ]
20+ [ Tooltip ( "The action to activate or deactivate the swapping volume." ) ]
21+ private MixedRealityInputAction selectAction = MixedRealityInputAction . None ;
22+
1823 [ SerializeField ]
1924 [ Tooltip ( "The scene object to be hidden when the active solver is enabled." ) ]
2025 private GameObject hideThisObject = null ;
@@ -53,6 +58,11 @@ public void OnPointerDown(MixedRealityPointerEventData eventData) { }
5358
5459 public void OnPointerClicked ( MixedRealityPointerEventData eventData )
5560 {
61+ if ( eventData . MixedRealityInputAction != selectAction )
62+ {
63+ return ;
64+ }
65+
5666 if ( spawnedObject . activeSelf )
5767 {
5868 spawnedObject . SetActive ( false ) ;
@@ -72,6 +82,10 @@ public void OnPointerClicked(MixedRealityPointerEventData eventData)
7282 {
7383 solverHandler . TrackedObjectToReference = TrackedObjectType . MotionControllerLeft ;
7484 }
85+ else
86+ {
87+ solverHandler . TrackedObjectToReference = TrackedObjectType . Head ;
88+ }
7589 }
7690
7791 hideThisObject . SetActive ( false ) ;
0 commit comments