@@ -254,16 +254,27 @@ protected virtual void UpdateHandMesh()
254
254
255
255
IMixedRealityInputSystem inputSystem = CoreServices . InputSystem ;
256
256
MixedRealityHandTrackingProfile handTrackingProfile = inputSystem ? . InputSystemProfile != null ? inputSystem . InputSystemProfile . HandTrackingProfile : null ;
257
- if ( newMesh &&
258
- handTrackingProfile != null &&
259
- handTrackingProfile . SystemHandMeshMaterial != null )
257
+ if ( newMesh && handTrackingProfile != null )
260
258
{
261
259
// Create the hand mesh in the scene and assign the proper material to it
262
- handMeshFilter = new GameObject ( "System Hand Mesh" ) . EnsureComponent < MeshFilter > ( ) ;
263
- handMeshFilter . EnsureComponent < MeshRenderer > ( ) . material = CoreServices . InputSystem . InputSystemProfile . HandTrackingProfile . SystemHandMeshMaterial ;
264
-
265
- lastHandMeshVerticesCount = handMeshFilter . mesh . vertices . Length ;
266
- handMeshFilter . transform . parent = transform ;
260
+ if ( handTrackingProfile . SystemHandMeshMaterial . IsNotNull ( ) )
261
+ {
262
+ handMeshFilter = new GameObject ( "System Hand Mesh" ) . EnsureComponent < MeshFilter > ( ) ;
263
+ handMeshFilter . EnsureComponent < MeshRenderer > ( ) . material = handTrackingProfile . SystemHandMeshMaterial ;
264
+ }
265
+ #pragma warning disable 0618
266
+ else if ( handTrackingProfile . HandMeshPrefab . IsNotNull ( ) )
267
+ {
268
+ handMeshFilter = Instantiate ( handTrackingProfile . HandMeshPrefab ) . GetComponent < MeshFilter > ( ) ;
269
+ }
270
+ #pragma warning restore 0618
271
+
272
+ // Initialize the hand mesh if we generated it successfully
273
+ if ( handMeshFilter != null )
274
+ {
275
+ lastHandMeshVerticesCount = handMeshFilter . mesh . vertices . Length ;
276
+ handMeshFilter . transform . parent = transform ;
277
+ }
267
278
}
268
279
269
280
if ( handMeshFilter != null )
@@ -300,7 +311,7 @@ protected virtual void UpdateHandMesh()
300
311
mesh . RecalculateBounds ( ) ;
301
312
}
302
313
303
- handMeshFilter . transform . SetPositionAndRotation ( eventData . InputData . position , eventData . InputData . rotation ) ;
314
+ handMeshFilter . transform . SetPositionAndRotation ( lastHandMeshInfo . position , lastHandMeshInfo . rotation ) ;
304
315
}
305
316
}
306
317
}
0 commit comments