void HandleFrameEvent(object sender, LMWidgets.EventArg <FrameData> e) { HandModel oldFound = null; // attempt to reconnect to the last good id HandModel[] handList = ReturnPhysicsHand ? e.CurrentValue.PhysicsModels : e.CurrentValue.HandModels; foreach (HandModel handInScene in handList) { if (handInScene.GetLeapHand().Id == lastHandId) { oldFound = handInScene; } } // on failure attempt to find a new good left hand if (!oldFound) { CurrentHand = FirstRightHand(handList); if (CurrentHand) { lastHandId = CurrentHand.GetLeapHand().Id; } } else { CurrentHand = oldFound; } }