Skip to content

Commit 02ea52d

Browse files
committed
Ensure the bounds are recalculated
Otherwise, they'll stay vaguely at the origin on some platforms, which causes Unity to clip them as you look away from the origin
1 parent d147fb1 commit 02ea52d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ protected void Update()
9595
if (meshInfo.ChangeState == MeshChangeState.Added
9696
|| meshInfo.ChangeState == MeshChangeState.Updated)
9797
{
98-
handRenderer.enabled = true;
99-
10098
meshSubsystem.GenerateMeshAsync(meshInfo.MeshId, meshFilter.mesh,
10199
null, MeshVertexAttributes.Normals, result => { });
102100

101+
handRenderer.enabled = true;
102+
103103
// This hand mesh is provided pre-translated from the world origin,
104104
// so we want to ensure the mesh is "centered" at the world origin
105105
transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
@@ -110,6 +110,7 @@ protected void Update()
110110
&& handMeshTracker.TryGetHandMesh(FrameTime.OnUpdate, meshFilter.mesh)
111111
&& handMeshTracker.TryLocateHandMesh(FrameTime.OnUpdate, out Pose pose))
112112
{
113+
meshFilter.mesh.RecalculateBounds();
113114
handRenderer.enabled = true;
114115

115116
if (!initializedUVs && handMeshTracker.TryGetHandMesh(FrameTime.OnUpdate, neutralPoseMesh, HandPoseType.ReferenceOpenPalm))

0 commit comments

Comments
 (0)