//Get the current hand direction EDirection GetClosestDirection(ref bool a_bDetected) { DetectionManager.DetectionHand detectionHand = DetectionManager.Get().GetHand(m_Hand); if (!detectionHand.IsSet()) { a_bDetected = false; return(EDirection.eDownwards); } Vector3 handDirection = detectionHand.GetHandAxis(m_HandAxis); float currentDistance = float.MaxValue; EDirection currentDir = EDirection.eUpwards; foreach (EDirection dir in m_DirectionMap.Keys) { float newDistance = Vector3.Distance(handDirection, m_DirectionMap[dir]); if (newDistance < currentDistance) { currentDistance = newDistance; currentDir = dir; a_bDetected = true; } } return(currentDir); }