void Update() { //Gets the current gesture System.Collections.Generic.List <Leap.Hand> hands = gestureRecogniser.getFrameHands(); string current_gesture = gestureRecogniser.Recognise(hands[0]); if (current_gesture == "UI" && created_ui == null) { createUI(hands[0], (hands[0].PalmPosition.ToVector3() - hands[1].PalmPosition.ToVector3()).normalized); } else if (current_gesture == "UI") { created_ui.transform.rotation = camera_.transform.rotation; created_ui.transform.LookAt(camera_); if (initialAlpha < 1.0f) { increaseMyAlpha(); } } else { DestroyImmediate(created_ui); created_ui = null; } }
// Update is called once per frame void Update() { System.Collections.Generic.List <Leap.Hand> hands = gestureRecogniser.getFrameHands(); if (hands.Count >= 1) { string current_gesture = gestureRecogniser.Recognise(hands [0]); if (current_gesture == "FIST") { Firing fire = gun.GetComponent <Firing> (); fire.Fire(); } } }
void ShipControls() { //Gets The Current Hands In Frame System.Collections.Generic.List <Leap.Hand> hands = gestureRecogniser.getFrameHands(); if (hands.Count == 2) { //Gets current gestures of each hand string left_hand_gesture = gestureRecogniser.Recognise(hands [0]); Leap.Hand r_hand = hands [1]; Leap.Hand l_hand = hands [0]; //Shoot if right hand is in a fist if (left_hand_gesture == "FIST") { vehicle.transform.FindChild("MyGuns").gameObject.GetComponent <Firing> ().fire = true; } //If there is a right hand if (r_hand != null) { //Get angles required and pass them into their respective functions float RollAngle = r_hand.PalmNormal.Roll; float PitchAngle = r_hand.Direction.Pitch; Tilt(RollAngle); Rise(PitchAngle); } //Cap the speed at the top speed if (speed <= topSpeed) { speed += acceleration; acceleration += .001f; } //Added slipperiness to flight, to make it more natural velocity = (velocity.normalized + (vehicle.transform.forward) / (handling * 1.5f)) * speed * Time.deltaTime; } else { //Dampen speed and acceleration speed *= .99f; acceleration *= .99f; } //Move vehicle by velocity vehicle.transform.position += velocity; }
void flight() { System.Collections.Generic.List <Leap.Hand> hands = gestureRecogniser.getFrameHands(); if (hands.Count == 2) { string current_gesture = gestureRecogniser.Recognise(hands[1]); string for_ui = gestureRecogniser.Recognise(hands[0]); string slow_down = gestureRecogniser.Recognise(hands [1]); Leap.Hand r_hand = hands [1]; if (for_ui == "FIST") { topSpeed = nitrosSpeed; acceleration = .6f; } else if (for_ui == "UI") { damper = .6f; acceleration = .07f; } else { topSpeed = currentMaxSpeed; damper = .99f; } if (r_hand != null) { float RollAngle = r_hand.PalmNormal.Roll; float PitchAngle = r_hand.Direction.Pitch; Tilt(RollAngle); Rise(PitchAngle); } if (speed <= topSpeed) { speed += acceleration; acceleration += .008f; } } vehicle.transform.position += velocity; speed *= damper; velocity = (velocity.normalized * 2.0f + (vehicle.transform.forward)).normalized * speed * Time.deltaTime; speedometer.fillAmount = speed / topSpeed; }
void Update() { System.Collections.Generic.List <Leap.Hand> hands = gestureRecogniser.getFrameHands(); if (hands.Count == 2) { string current_gesture = gestureRecogniser.Recognise(hands[1]); string for_ui = gestureRecogniser.Recognise(hands[0]); Leap.Hand r_hand = hands [1]; if (for_ui == "FIST") { topSpeed = nitrosSpeed; } else { topSpeed = currentMaxSpeed; } if (r_hand != null) { float RollAngle = r_hand.PalmNormal.Roll; float PitchAngle = r_hand.Direction.Pitch; Tilt(RollAngle); Rise(PitchAngle); } //Added slipperiness to flight, to make it more natural velocity = (velocity.normalized + (vehicle.transform.forward) / (handling * 1.5f)) * speed * Time.deltaTime; } vehicle.transform.position += velocity; speed *= .99f; if (speed <= topSpeed) { Debug.Log("Making it to increase speed"); speed += acceleration; } }