Skip to content

Commit ca134f0

Browse files
authored
Merge pull request #9890 from keveleigh/floating-hands
Fixes floating stale hands and doubled mesh with Windows XR Plugin
2 parents c13a492 + 3c1c2f1 commit ca134f0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Assets/MRTK/Providers/WindowsMixedReality/Shared/WindowsMixedRealityHandMeshProvider.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,28 @@ public void UpdateHandMesh(SpatialInteractionSourceState sourceState)
209209

210210
if (vertexAndNormals != null && handMeshTriangleIndices != null)
211211
{
212-
var handMeshVertexState = handMeshObserver.GetVertexStateForPose(handPose);
212+
HandMeshVertexState handMeshVertexState = null;
213+
try
214+
{
215+
handMeshVertexState = handMeshObserver.GetVertexStateForPose(handPose);
216+
}
217+
catch (ArgumentException)
218+
{
219+
Debug.Log($"{nameof(WindowsMixedRealityHandMeshProvider)} failed to update the hand mesh. This might happen if a source was detected and lost rapidly. Otherwise, the mesh might be stale this frame.");
220+
}
221+
222+
if (handMeshVertexState == null)
223+
{
224+
return;
225+
}
226+
213227
handMeshVertexState.GetVertices(vertexAndNormals);
214228

215229
var meshTransform = handMeshVertexState.CoordinateSystem.TryGetTransformTo(WindowsMixedRealityUtilities.SpatialCoordinateSystem);
216230
if (meshTransform.HasValue)
217231
{
218232
System.Numerics.Matrix4x4.Decompose(meshTransform.Value,
219-
out System.Numerics.Vector3 scale,
233+
out _,
220234
out System.Numerics.Quaternion rotation,
221235
out System.Numerics.Vector3 translation);
222236

0 commit comments

Comments
 (0)