void CompleteRevert(RigidHand myHand) { revertTime = 0.0f; FingoGestureEvent.OnFingoGraspStart -= OnHandGraspStart; FingoGestureEvent.OnFingoGraspingPalmInfo -= OnHandGrasping; FingoGestureEvent.OnFingoRelease -= OnHandRelease; canRevertClips = false; notePostion = false; isExploded = false; revertEvent = false; GameObject.Destroy(mAudio); for (int j = 0; j < clips.Count; j++) { clips[j].rigidBody.isKinematic = false; } revertHandType = Fingo.HandType.Invalid; Exploder.FragmentPool.Instance.DeactivateFragments(); //this.mRigidbody.isKinematic = false; this.GetComponent <Collider>().enabled = true; ShowSelf(this.transform); RigidObject rigidObj = this.transform.GetComponent <RigidObject>(); myHand.GraspGameObjectInHand(rigidObj); }
public void ReleaseGameObject() { if (isGraspObj) { isGraspObj = false; handRenderer.enabled = true; graspObj.gameObject.SetActive(true); graspObj.HandRelease(); graspObj = null; GraspFrame = 0; } }
void GiveObjToHand(int id, RigidHand myHand) { if (cheatObj[id] == null) { return; } RigidObject temp = cheatObj[id].GetComponent <RigidObject>(); if (temp != null) { if (temp.GetComponent <ExplodeObj>() != null) { if (temp.GetComponent <ExplodeObj>().ResetToHand(myHand)) { return; } } myHand.GraspGameObjectInHand(temp); } }
public void GraspGameObjectInHand(RigidObject obj) { if (obj.isGrasped || meshHand.handType == Fingo.HandType.Left) { return; } if (graspObj != obj && graspObj != null) { graspObj.gameObject.SetActive(true); graspObj.HandRelease(); } graspObj = obj; isGraspObj = true; if (graspObj.leftHoldPoistion == null || graspObj.rightHoldPoistion == null) { graspObj.transform.position = this.transform.position; } graspObj.gameObject.SetActive(true); graspObj.HandGrasp(this); }
void Update() { //show or hide hand by hand's detect UpdateHideOrShowHand(); if (graspObj != null && graspObj.GetComponent <MusicBoxCtrl> () != null) { if (!meshHand.isDetected) { isGraspObj = false; handRenderer.enabled = true; graspObj.gameObject.SetActive(true); graspObj.HandRelease(); graspObj = null; GraspFrame = 0; } } if (!meshHand.isDetected) { if (isPostGraspEvent) { isPostGraspEvent = false; if (FingoGestureEvent.OnFingoRelease != null) { FingoGestureEvent.OnFingoRelease(meshHand.handType); } } } if (graspFingersNum < 1 && meshHand.isDetected) { //Where's my hand? if (Vector3.Distance(this.transform.position, Camera.main.transform.position) > 2.0f) { return; } //post release event if (isPostGraspEvent) { isPostGraspEvent = false; if (FingoGestureEvent.OnFingoRelease != null) { FingoGestureEvent.OnFingoRelease(meshHand.handType); } } //grasp release if (isGraspObj) { GraspFrame++; if (GraspFrame % graspDelayFrame == 0) { isGraspObj = false; handRenderer.enabled = true; graspObj.gameObject.SetActive(true); graspObj.HandRelease(); graspObj = null; GraspFrame = 0; } } return; } if (graspFingersNum > 2 && meshHand.isDetected) { //post grasp start event if (!isPostGraspEvent) { isPostGraspEvent = true; if (FingoGestureEvent.OnFingoGraspStart != null) { FingoGestureEvent.OnFingoGraspStart(meshHand.handType); } } if (!isGraspObj && interactionThing != null) { GraspFrame++; if (GraspFrame % graspDelayFrame == 0) { //if obj is in another hand, this hand will be ignored graspObj = interactionThing.GetComponent <RigidObject>(); if (!graspObj.isGrasped) { //grasp start isGraspObj = true; graspObj.gameObject.SetActive(true); graspObj.HandGrasp(this); GraspFrame = 0; } } } } if (isPostGraspEvent) { if (FingoGestureEvent.OnFingoGraspingPalmInfo != null) { FingoGestureEvent.OnFingoGraspingPalmInfo(meshHand.handType, this); } } }