@@ -112,161 +112,57 @@ If no specific controller is given then utility classes are provided for conveni
112112
113113## Hand Tracking Events
114114
115- < ! -- The Input Simulation Service emulates the behaviour of devices and platforms that may not be available in the Unity editor . Examples include :
116- * Hololens or VR device head tracking
117- * Hololens version 1 hand gestures
118- * Hololens version 2 articulated hand tracking
115+ The input system provides events as well , if polling data from controllers directly is not desirable .
119116
120- Users can use a conventional keyboard and mouse combination to control simulated devices at runtime . This allows testing of interactions in the Unity editor without first deploying to a device .
117+ ### Joint Events
121118
122- ## Enabling the Input Simulation Service
119+ [IMixedRealityHandJointHandler]( xref : Microsoft . MixedReality . Toolkit . Input . IMixedRealityHandJointHandler ) handles updates of joint positions .
123120
124- Input simulation is enabled by default in MRTK .
125-
126- Input simulation is an optional [Mixed Reality service ](.. / .. / External / Documentation / MixedRealityServices .md ). It can be added as a data provider in the [Input System profile ](.. / TODO .md ).
127- * __Type__ must be _Microsoft .MixedReality .Toolkit .Input > InputSimulationService_ .
128- * __Platform (s )__ should always be _Windows Editor_ since the service depends on keyboard and mouse input .
129- * __Profile__ has all settings for input simulation .
130-
131- | __Warning__ : Any type of profile can be assigned to services at the time of this writing . If you assign a different profile to the service , make sure to use a profile of type _Input Simulation_ or it will not work ! |
132- | -- - |
133-
134- ! [Input System Data Providers ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_InputSystemDataProviders .png )
135-
136- Open the linked profile to access settings for input simulation .
137-
138- ! [Input System Data Providers ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_InputSimulationProfile .png )
139-
140- # Camera Control
141-
142- Head movement can be emulated by the Input Simulation Service .
143-
144- ! [Camera control settings ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_CameraControlSettings .png )
145-
146- ## Rotating the camera
147-
148- 1 . Hover over the viewport editor window .
149-
150- _You may need to click the window to give it input focus if button presses don 't work._
151-
152- 2 . Press and hold the __Mouse Look Button__ (default : Right mouse button ).
153- 3 . Move the mouse in the viewport window to rotate the camera .
154-
155- ## Moving the camera
156-
157- Press and hold the movement keys (W / A / S / D for forward / left / back / right ).
158-
159- -- -
160-
161- < video width = " 600" controls = " controls" >
162- < source type = " video/mp4" src = " ../../External/Documentation/Videos/MRTK_InputSimulation_CameraControl.mp4" >< / source >
163- < / video >
164-
165- # Hand Simulation
166-
167- The input simulation supports emulated hand devices . These virtual hands can interact with any object that supports regular hand devices , such as buttons or grabable objects .
168-
169- ! [Hand simulation mode ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_HandSimulationMode .png )
170-
171- The __Hand Simulation Mode__ switches between two distinct input models .
172-
173- * _Articulated Hands_ : Simulates a fully articulated hand device with joint position data .
174-
175- Emulates Hololens version 2 interaction model .
176-
177- Interactions that are based precise positioning of the hand or use touching can be simulated in this mode .
178-
179- * _Gestures_ : Simulates a simplified hand model with air tap and basic gestures .
180-
181- Emulates [Hololens version 1 interaction model ](https :// docs.microsoft.com/en-us/windows/mixed-reality/gestures).
182-
183- Focus is controlled using the Gaze pointer . The _Air Tap_ gesture is used to interact with buttons .
184-
185- ## Controlling hand movement
186-
187- 
188-
189- Press and hold the _Left / Right Hand Manipulation Key_ (default : Left Shift / Space for left / right respectively ) to gain control of either hand . While the manipulation key is pressed , the hand will appear in the viewport . Mouse movement will move the hand in the view plane .
190-
191- Once the manipulation key is released the hands will disappear after a short _Hand Hide Timeout_ . To toggle hands on permanently , press the _Toggle Left / Right Hand Key_ (default : T / Y for left / right respectively ). Press the toggle key again to hide the hands again .
192-
193- ! [Hand placement settings ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_HandPlacementSettings .png )
194-
195- Hands can be moved further or closer to the camera using the _mouse wheel_ .
196-
197- ! [Hand rotation settings ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_HandRotationSettings .png )
198-
199- Hands can be rotated when precise direction is required .
200- * Yaw rotates around the Y axis (default : E /Q keys for clockwise /counter -clockwise rotation )
201- * Pitch rotates around the X axis (default : F / R keys for clockwise / counter - clockwise rotation )
202- * Roll rotates around the Z axis (default : X / Z keys for clockwise / counter - clockwise rotation )
203-
204- -- -
205-
206- < video width = " 600" controls = " controls" >
207- < source type = " video/mp4" src = " ../../External/Documentation/Videos/MRTK_InputSimulation_HandMovement.mp4" >< / source >
208- < / video >
209-
210- ## Hand Gestures
211-
212- Hand gestures such as pinching , grabbing , poking , etc . can also be simulated .
213-
214- ! [Hand gesture settings ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_HandGestureSettings .png )
215-
216- 1 . First enable hand control using the manipulation keys (Left Shift / Space )
217-
218- Alternatively toggle the hands on / off using the toggle keys (T / Y ).
219-
220- 2 . While manipulating , press and hold a mouse button to perform a hand gesture .
221-
222- Each of the mouse buttons can be mapped to transform the hand shape into a different gesture using the _Left / Middle / Right Mouse Hand Gesture_ settings . The _Default Hand Gesture_ is the shape of the hand when no button is pressed.
223-
224- | Note : The _Pinch_ gesture is the only gesture that performs the "Select " action at this point . |
225- | -- - |
226-
227- ## One-Hand Manipulation
228-
229- 1 . Press and hold hand control key (Space / Left Shift )
230- 2 . Point at object
231- 3 . Hold mouse button to pinch
232- 4 . Use mouse to move the object
233- 5 . Release mouse button to stop interaction
234-
235- -- -
236-
237- < video width = " 600" controls = " controls" >
238- < source type = " video/mp4" src = " ../../External/Documentation/Videos/MRTK_InputSimulation_OneHandManipulation.mp4" >< / source >
239- < / video >
240-
241- ## Two-Hand Manipulation
121+ ```csharp
122+ public class MyHandJointEventHandler : IMixedRealityHandJointHandler
123+ {
124+ public Handedness myHandedness ;
242125
243- For manipulating objects with two hands at the same time the persistent hand mode is recommended .
126+ void IMixedRealityHandJointHandler .OnHandJointsUpdated (InputEventData < IDictionary < TrackedHandJoint , MixedRealityPose >> eventData )
127+ {
128+ if (eventData .Handedness == myHandedness )
129+ {
130+ if (eventData .InputData .TryGetValue (TrackedHandJoint .IndexTip , out MixedRealityPose pose ))
131+ {
132+ // ...
133+ }
134+ }
135+ }
136+ }
137+ ```
244138
245- 1. Toggle on both hands by pressing the toggle keys (T /Y ).
246- 2. Manipulate one hand at a time :
247- 1 . Hold _Space_ to control the right hand
248- 2 . Move the hand to where you want to grab the object
249- 3 . Press mouse button to activate the _Pinch_ gesture . In persistent mode the gesture will remain active when you release the mouse button .
250- 3 . Repeat the process with the other hand , grabbing the same object in a second spot .
251- 4 . Now that both hands are grabbing the same object , you can move either of them to perform two - handed manipulation .
139+ ### Mesh Events
252140
253- -- -
141+ [ IMixedRealityHandMeshHandler ]( xref : Microsoft . MixedReality . Toolkit . Input . IMixedRealityHandMeshHandler ) handles changes of the articulated hand mesh .
254142
255- < video width = " 600" controls = " controls" >
256- < source type = " video/mp4" src = " ../../External/Documentation/Videos/MRTK_InputSimulation_TwoHandManipulation.mp4" >< / source >
257- < / video >
143+ Note that hand meshes are not enabled by default .
258144
259- ## GGV Interaction
145+ ```csharp
146+ public class MyHandMeshEventHandler : IMixedRealityHandMeshHandler
147+ {
148+ public Handedness myHandedness ;
149+ public Mesh myMesh ;
260150
261- 1 . Enable GGV simulation by switching __Hand Simulation Mode__ to _Gestures_ in the [Input Simulation Profile ](#enabling - the - input - simulation - service )
262- ! [Hand gesture settings ](.. / .. / External / Documentation / Images / MRTK_InputSimulation_SwitchToGGV .png )
263- 2 . Rotate the camera to point the gaze cursor at the interactable object (right mouse button )
264- 3 . Hold _Space_ to control the right hand
265- 4 . Click and hold _left mouse button_ to interact
266- 5 . Rotate the camera again to manipulate the object
151+ public void OnHandMeshUpdated (InputEventData < HandMeshInfo > eventData )
152+ {
153+ if (eventData .Handedness == myHandedness )
154+ {
155+ myMesh .vertices = eventData .InputData .vertices ;
156+ myMesh .normals = eventData .InputData .normals ;
157+ myMesh .triangles = eventData .InputData .triangles ;
267158
268- -- -
159+ if (eventData .InputData .uvs != null && eventData .InputData .uvs .Length > 0 )
160+ {
161+ myMesh .uv = eventData .InputData .uvs ;
162+ }
269163
270- < video width = " 600" controls = " controls" >
271- < source type = " video/mp4" src = " ../../External/Documentation/Videos/MRTK_InputSimulation_GGVManipulation.mp4" >< / source >
272- < / video > -- >
164+ // ...
165+ }
166+ }
167+ }
168+ ```
0 commit comments