// Start is called before the first frame update void Start() { grab = ManoGestureContinuous.CLOSED_HAND_GESTURE; pinch = ManoGestureContinuous.HOLD_GESTURE; cubeRenderer = GetComponent <Renderer>(); cubeRenderer.material = cubeMaterial; cubeRenderer.sharedMaterial = cubeMaterial; }
private void Initialize() { pinch = ManoGestureContinuous.HOLD_GESTURE; release = ManoGestureContinuous.OPEN_HAND_GESTURE; open = ManoGestureContinuous.OPEN_PINCH_GESTURE; grab = ManoGestureContinuous.CLOSED_HAND_GESTURE; point = ManoGestureContinuous.POINTER_GESTURE; normVec = new Vector3(0, 0, 0); }
void OnTriggerStay(Collider trigCol) { if (trigCol.gameObject.tag.Equals("hand")) { HandInfo myTrackingInfo = ManomotionManager.Instance.Hand_infos[0].hand_info; ManoGestureContinuous myGestureInfo = myTrackingInfo.gesture_info.mano_gesture_continuous; grabMove(myTrackingInfo, myGestureInfo, trigCol); } }
private void Initialize() { grab = ManoGestureContinuous.CLOSED_HAND_GESTURE; pinch = ManoGestureContinuous.HOLD_GESTURE; openPinch = ManoGestureContinuous.OPEN_PINCH_GESTURE; click = ManoGestureTrigger.CLICK; grabTrigger = ManoGestureTrigger.GRAB_GESTURE; cubeRenderer = GetComponent <Renderer>(); cubeRenderer.sharedMaterial = arCubeMaterial[0]; cubeRenderer.material = arCubeMaterial[0]; handCollider = GameObject.FindGameObjectsWithTag("Player")[0]; actionCoolDown = 0; defaultParent = transform.parent.gameObject; FreeFall(); }
HandState GetStateForGesture(ManoGestureContinuous gesture) { switch (gesture) { case ManoGestureContinuous.OPEN_HAND_GESTURE: return(HandState.PAPER); case ManoGestureContinuous.POINTER_GESTURE: return(HandState.POINTER); case ManoGestureContinuous.CLOSED_HAND_GESTURE: return(HandState.ROCK); default: return(HandState.UNKNOWN); } }
void grabMove(HandInfo trackingInfo, ManoGestureContinuous gesture_info, Collider trigCol) { // checked if we have a closed hand if (gesture_info == ManoGestureContinuous.CLOSED_HAND_GESTURE) { //Change the color of the object being held to green gameObject.GetComponent <Renderer>().material.color = Color.magenta; // Get the position of the centre of hand Vector3 normalizedPalmCentre = trackingInfo.tracking_info.palm_center; float depth = trackingInfo.tracking_info.depth_estimation; Vector3 relativePalmCentrePosition = ManoUtils.Instance.CalculateNewPosition(normalizedPalmCentre, depth); //Move the object with hand float smoothingVariable = 0.85f; gameObject.transform.position = trigCol.gameObject.transform.position; } else { gameObject.GetComponent <Renderer>().material.color = Color.green; } }
/// <summary> /// Displays information regarding the detected manoclass /// </summary> /// <param name="manoGestureContinuous">Requires a continuous Gesture.</param> void DisplayContinuousGestures(ManoGestureContinuous manoGestureContinuous) { continuousGestureGizmo.SetActive(Show_continuous_gestures); if (Show_continuous_gestures) { switch (manoGestureContinuous) { case ManoGestureContinuous.CLOSED_HAND_GESTURE: continuousGestureText.text = "Continuous:Closed Hand"; break; case ManoGestureContinuous.OPEN_HAND_GESTURE: continuousGestureText.text = "Continuous:Open Hand"; break; case ManoGestureContinuous.HOLD_GESTURE: continuousGestureText.text = "Continuous:Hold"; break; case ManoGestureContinuous.OPEN_PINCH_GESTURE: continuousGestureText.text = "Continuous:Open Pinch"; break; case ManoGestureContinuous.POINTER_GESTURE: continuousGestureText.text = "Continuous:Pointing"; break; case ManoGestureContinuous.NO_GESTURE: continuousGestureText.text = "Continuous:None"; break; default: continuousGestureText.text = "Continuous:None"; break; } } }