Skip to content

Commit a4f6f07

Browse files
committed
Update PlatformHandMeshVisualizer.cs
1 parent 82dde7e commit a4f6f07

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

org.mixedrealitytoolkit.input/Visualizers/PlatformHandVisualizer/PlatformHandMeshVisualizer.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,20 @@ protected void Update()
118118
|| meshInfo.ChangeState == MeshChangeState.Updated)
119119
{
120120
meshSubsystem.GenerateMeshAsync(meshInfo.MeshId, meshFilter.mesh,
121-
null, MeshVertexAttributes.Normals, result => { });
122-
123-
handRenderer.enabled = true;
124-
125-
// This hand mesh is provided pre-translated from the world origin,
126-
// so we want to ensure the mesh is "centered" at the world origin
127-
PlayspaceUtilities.XROrigin.CameraFloorOffsetObject.transform.GetPositionAndRotation(out Vector3 position, out Quaternion rotation);
128-
transform.SetPositionAndRotation(position, rotation);
121+
null, MeshVertexAttributes.Normals, result =>
122+
{
123+
if (result.Status == MeshGenerationStatus.Success)
124+
{
125+
transform.SetWorldPose(PlayspaceUtilities.TransformPose(new Pose(result.Position, result.Rotation)));
126+
transform.localScale = result.Scale;
127+
128+
handRenderer.enabled = true;
129+
}
130+
else if (result.Status != MeshGenerationStatus.GenerationAlreadyInProgress)
131+
{
132+
handRenderer.enabled = false;
133+
}
134+
}, MeshGenerationOptions.ConsumeTransform);
129135
}
130136
}
131137
#if MROPENXR_PRESENT && (UNITY_STANDALONE_WIN || UNITY_WSA || UNITY_ANDROID)

0 commit comments

Comments
 (0)