//public void OnCollisionEnter(Collision collision) //{ // isDouble = (Time.realtimeSinceStartup - lastShot < doubleInterval); // if (!isDouble && Time.realtimeSinceStartup - lastShot < interval) return; // LeapBoxingObject leapObj = collision.gameObject.GetComponent<LeapBoxingObject>(); // if (leapObj) // { // //Debug.Log("mang : " + leapObj.maxVelocity.magnitude); // //Debug.Log("velo : " + leapObj.maxVelocity); // //Debug.Log("norm : " + leapObj.maxVelocity.normalized); // //Debug.Log("dir : " + (collision.transform.position - transform.position)); // //if (leapObj.maxVelocity.z > 0) return; // //Debug.Log(leapObj.maxVelocity.magnitude); // Vector3 initPos = (Vector3.up * 2) + (Camera.main.transform.forward * 5); // mentosCopy = Instantiate(mentos, collision.gameObject.transform.position, Quaternion.identity) as GameObject; // mentosCopy.transform.position += initPos; // mentosCopy.rigidbody.AddForce(Camera.main.transform.forward * force); // if (isDouble) // { // mentosCopy = Instantiate(mentos, collision.gameObject.transform.position, Quaternion.identity) as GameObject; // mentosCopy.transform.position += (Camera.main.transform.right * 3) + initPos; // mentosCopy.rigidbody.AddForce(Camera.main.transform.forward * force); // mentosCopy = Instantiate(mentos, collision.gameObject.transform.position, Quaternion.identity) as GameObject; // mentosCopy.transform.position += -(Camera.main.transform.right * 3) + initPos; // mentosCopy.rigidbody.AddForce(Camera.main.transform.forward * force); // } // lastShot = Time.realtimeSinceStartup; // } //} void Start() { LeapHandController hc = GameObject.Find("Leap Controller Multiple/_leapController").GetComponent<LeapHandController>(); ind1 = GameObject.Find("OVRCameraController/CameraLeft/h1Ind").renderer; ind2 = GameObject.Find("OVRCameraController/CameraRight/h2Ind").renderer; nt = GameObject.Find("Networking").GetComponent<Networking>(); h1 = hc.unityHands[0]; h2 = hc.unityHands[1]; _mechaController = GameObject.Find("Mecha").GetComponent<UpdateMechaRotation>(); interval = _mechaController.animation.GetClip("Left Shot").length; }
void Update() { UnityHand unityHand = GetComponent <UnityHand>(); if (unityHand.GetLeapHand().GrabStrength > 0.4f) { unityHand.EnableMesh(false); } else { unityHand.EnableMesh(true); } }
public virtual void SetOwner(UnityHand h) { unityHand = h; }
public FingerDetection(UnityHand hand) { unityHand = hand; }
bool canFire(UnityHand h) { return isHandExists(h); print("Closed : " + isHandClosed(h)); print("Exists : " + isHandExists(h)); return isHandClosed(h) && isHandExists(h); }
bool isHandClosed(UnityHand h) { //print(h.leapFingers.Count + " : " + h.unityFingers.Count); return (h.leapFingers.Count < 2); }
bool isHandExists(UnityHand h) { return h.handFound; }
bool isHandClosed(UnityHand h) { return (h.leapFingers.Count < 2); }
bool canFire(UnityHand h) { return isHandClosed(h) && isHandExists(h); }