/***************************************************** * UPDATE SWIPE ROTATION * * INFO: Evenement qui permet de maintenir a jour la * rotation de l'objet lorsque l'utilisateur effectue * un geste Swipe. * * *** TO OPTIMIZE *** * *****************************************************/ public void UpdateSwipeRotation() { //Si la manipulation contrôlé d'objet est activé if (PalmUIController.GetInstance().IsManipulationControlled()) { //La liste des objets sélectionnés avec le raycast List <SelectedObject> objectsToRotateList = SelectionController.GetInstance().GetSelectedObjects(); if (objectsToRotateList.Count > 0) { //Le type de Swipe effectué (gauche, droite, haut, bas) swipeType = GestureMediator.GetGestureType(); if (swipeType.Contains("Swipe")) { foreach (SelectedObject objectToRotate in objectsToRotateList) { detectedHand = DetectionController.GetInstance().GetHand(GestureMediator.GetDetectedHand()); float velocityX = 0f; float velocityY = 0f; //La velocité du swipe en X ou Y if (isRotationX) { velocityX = -detectedHand.GetHandVelocity().x; } if (isRotationY) { velocityY = detectedHand.GetHandVelocity().y; } allowCoroutine = true; //Rotation horizontale (Swipe gauche ou droite) if (isRotationX && (swipeType.Contains("droite") || swipeType.Contains("gauche"))) { //Demarre la rotation horizontale selon le type choisi (swipe lock angle / swipe velocity) Vector3 axis = Mathf.Sign(velocityX) * Vector3.up; StartCoroutine(isLockRotation ? RotateWhenSwipe(objectToRotate.TransformObject, axis, rotationAngle, secondsToRotate) : RotateFreeWhenSwipe(objectToRotate.TransformObject, axis, velocityX)); } //Rotation verticale (Swipe haut ou bas) if (isRotationY && (swipeType.Contains("haut") || swipeType.Contains("bas"))) { //Demarre la rotation verticale selon le type choisi (swipe lock angle / swipe velocity) Vector3 axis = Mathf.Sign(velocityY) * Vector3.right; StartCoroutine(isLockRotation ? RotateWhenSwipe(objectToRotate.TransformObject, axis, rotationAngle, secondsToRotate) : RotateFreeWhenSwipe(objectToRotate.TransformObject, axis, velocityY)); } } } } } }
/***************************************************** * UPDATE SWIPE SLIDERS * * INFO: Permet de demarrer le Timer du slider pour * le type de geste swipe détecté. * * *** TO OPTIMIZE *** * *****************************************************/ private void UpdateSwipeSliders() { //Recupere le type de geste détecté string gesture = GestureMediator.GetGestureType(); HandsE hand = GestureMediator.GetDetectedHand(); // Glissements de la main gauche if (hand == HandsE.gauche && gesture.Contains("Swipe")) { if (gesture == "Swipe gauche") { StartCoroutine(SwipeSliderTimer(leftHandSwipeSliders[0])); } if (gesture == "Swipe droite") { StartCoroutine(SwipeSliderTimer(leftHandSwipeSliders[1])); } if (gesture == "Swipe haut") { StartCoroutine(SwipeSliderTimer(leftHandSwipeSliders[2])); } if (gesture == "Swipe bas") { StartCoroutine(SwipeSliderTimer(leftHandSwipeSliders[3])); } } // Glissements de la main droite if (hand == HandsE.droite && gesture.Contains("Swipe")) { if (gesture == "Swipe gauche") { StartCoroutine(SwipeSliderTimer(rightHandSwipeSliders[0])); } if (gesture == "Swipe droite") { StartCoroutine(SwipeSliderTimer(rightHandSwipeSliders[1])); } if (gesture == "Swipe haut") { StartCoroutine(SwipeSliderTimer(rightHandSwipeSliders[2])); } if (gesture == "Swipe bas") { StartCoroutine(SwipeSliderTimer(rightHandSwipeSliders[3])); } } }
/***************************************************** * UPDATE CLAP HAND SLIDERS * * INFO: ... * *****************************************************/ private void UpdateClapSliders() { //Recupere le type de geste détecté string gesture = GestureMediator.GetGestureType(); if (gesture.Contains("Clap")) { if (DetectionController.GetInstance().IsHandDetected(HandsE.gauche) && GestureMediator.GetDetectedHand() == HandsE.gauche) { StartCoroutine(SwipeSliderTimer(clapLeftHand)); } if (DetectionController.GetInstance().IsHandDetected(HandsE.droite) && GestureMediator.GetDetectedHand() == HandsE.droite) { StartCoroutine(SwipeSliderTimer(clapRightHand)); } } }