File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Assets/MixedRealityToolkit/Providers/Hands Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -182,13 +182,16 @@ public void OnHandMeshUpdated(InputEventData<HandMeshInfo> eventData)
182182 {
183183 Mesh mesh = handMeshFilter . mesh ;
184184
185+ bool meshChanged = false ;
185186 // On some platforms, mesh length counts may change as the hand mesh is updated.
186187 // In order to update the vertices when the array sizes change, the mesh
187188 // must be cleared per instructions here:
188189 // https://docs.unity3d.com/ScriptReference/Mesh.html
189- if ( lastHandMeshVertices . Length != 0 &&
190+ if ( lastHandMeshVertices != null &&
191+ lastHandMeshVertices . Length != 0 &&
190192 lastHandMeshVertices . Length != eventData . InputData . vertices ? . Length )
191193 {
194+ meshChanged = true ;
192195 mesh . Clear ( ) ;
193196 }
194197
@@ -202,7 +205,10 @@ public void OnHandMeshUpdated(InputEventData<HandMeshInfo> eventData)
202205 mesh . uv = eventData . InputData . uvs ;
203206 }
204207
205- mesh . RecalculateBounds ( ) ;
208+ if ( meshChanged )
209+ {
210+ mesh . RecalculateBounds ( ) ;
211+ }
206212
207213 handMeshFilter . transform . position = eventData . InputData . position ;
208214 handMeshFilter . transform . rotation = eventData . InputData . rotation ;
You can’t perform that action at this time.
0 commit comments