public override void GraspStart(RigidHand myHand) { isRaiseMusic = true; this.mHand = myHand; nowPos = myHand.transform.position; audioPlayer.Stop(); }
public LeapHand(RigidHand hand) { if (hand.palm != null) { this.palm = new Guidance(hand.palm); } if (hand.forearm != null) { this.forearm = new Guidance(hand.forearm); } if (hand.elbowJoint != null) { this.elbowJoint = new Guidance(hand.elbowJoint); } FingerModel[] fingersModel = hand.fingers; this.fingers = new Guidance[fingersModel.Length, FingerModel.NUM_BONES]; for (int i = 0; i < fingersModel.Length; i++) { for (int j = 0; j < FingerModel.NUM_BONES; ++j) { if (fingersModel[i] != null && fingersModel[i].bones[j] != null) { this.fingers[i, j] = new Guidance(fingersModel[i].bones[j]); } } } this.handedness = hand.Handedness; }
void DoRevertClipsAnimation(Fingo.HandType handType, RigidHand myHand) { //Debug.Log(handType.ToString() + " DoRevertClipsAnimation"); revertTime += Time.deltaTime * 1.2f; for (int i = 0; i < clips.Count; i++) { Vector3 aminPos = this.transform.TransformPoint(clips[i].explodeMomentlocalPosition); Vector3 aminRot = this.transform.TransformVector(clips[i].explodeMomentlocalRotation.eulerAngles); if (revertTime > 1.0f) { clips[i].transform.position = aminPos; clips[i].transform.eulerAngles = aminRot; } else { clips[i].transform.eulerAngles = Lerp(clipsOriginAngle[i], aminRot, revertTime); clips[i].transform.position = Lerp(clipsOriginPos[i], aminPos, revertTime); } } if (revertTime > 1.0f) { CompleteRevert(myHand); } }
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 virtual void GraspStart(RigidHand myHand) { this.transform.parent = myHand.transform; rbody.velocity = Vector3.zero; rbody.isKinematic = true; if (myHand.meshHand.handType == Fingo.HandType.Right) { if (rightHoldPoistion != null) { this.transform.localRotation = rightHoldPoistion.localRotation; this.transform.position = myHand.transform.position + (this.transform.position - rightHoldPoistion.position); } } else { if (leftHoldPoistion != null) { this.transform.localRotation = leftHoldPoistion.localRotation; this.transform.position = myHand.transform.position + (this.transform.position - leftHoldPoistion.position); } } thisFramePosition = this.transform.position; thisFrameRotation = this.transform.rotation; thisFrameTimeStamp = Time.time; }
public override void Parabolic() { base.Parabolic(); Clean(); rigHand = null; curTrailRender = null; pinchState = 0; }
public override void GraspEnd() { base.GraspEnd(); Clean(); rigHand = null; curTrailRender = null; pinchState = 0; }
public override void GraspStart(RigidHand myHand) { base.GraspStart(myHand); Clean(); rigHand = myHand; AddLine(); pinchState = 1; }
public void OnValidate() { IHandModel ihm = gameObject.GetComponentInParent <IHandModel>(); if (ihm != null) { mano = (RigidHand)ihm; } }
public override void GraspEnd() { if (!isPowerOn) { this.GetComponent <Collider>().isTrigger = false; base.GraspEnd(); } this.myHand = null; electricSource.DisHighLight(); }
public override void GraspStart(RigidHand myHand) { base.GraspStart(myHand); this.transform.DOKill(); this.myHand = myHand; isPowerOn = false; TurnScreenOpenOrClose(false); electricSource.HighLight(); }
public override void GraspStart(RigidHand myHand) { base.GraspStart(myHand); if (myHand.meshHand.handType == Fingo.HandType.Right) { fakeRHand.SetActive(true); } else if (myHand.meshHand.handType == Fingo.HandType.Left) { fakeLHand.SetActive(true); } }
public bool ResetToHand(RigidHand rigidHand) { if (revertEvent) { CompleteRevert(rigidHand); return(true); } else { return(false); } }
public void UpdateHands(RigidHand leftRH, RigidHand rightRH) { if (leftRH.IsTracked) { Left.UpdateHand(leftRH.fingers); } if (rightRH.IsTracked) { Right.UpdateHand(rightRH.fingers); } }
public void OnCollisionEnter(Collision collision) { RigidHand leapObj = collision.gameObject.GetComponent <RigidHand>(); if (leapObj) { Debug.Log(leapObj.maxVelocity.magnitude); GetComponent <Rigidbody>().AddForceAtPosition(leapObj.maxVelocity * 200, leapObj.transform.position); } Application.LoadLevel(1); //sound.playOneShot (); }
void OnTriggerExit(Collider other) { if(hand != null && other.transform.root.GetComponent<RigidHand>() == hand && other.CompareTag("Palm")){ if (!interp){ grabSide.RemoveCubes(); //swipe.enabled = true; } //canRotate = false; hand = null; currentRotating = ""; grabSide.transform.FindChild("Cube").gameObject.SetActive(false); } }
public void OnCollisionEnter(Collision collision) { RigidHand leapObj = collision.gameObject.GetComponent <RigidHand>(); if (leapObj) { Debug.Log(leapObj.maxVelocity.magnitude); GetComponent <Rigidbody>().AddForceAtPosition(leapObj.maxVelocity * 200, leapObj.transform.position); } if (Obj6.GetComponent <Renderer>().material.mainTexture == textur2) { Application.LoadLevel(10); } }
void Awake() { UserRig userRig = UserRig.Instance; RigidHand rigidHand = GetComponentInParent <RigidHand>(); userHand = (rigidHand.Handedness == Chirality.Left) ? userRig.LeftHand : userRig.RightHand; fingertipData.Owner = this.gameObject.GetComponent <CapsuleCollider>(); fingertipData.HandModel = userHand; otherObjectList = new List <GameObject>(); fingertipData.HandModel.OnTrackingLost += InputProvider_HandTrackingLost; fingertipData.finger = finger; }
public void OnCollisionEnter(Collision collision) { RigidHand leapObj = collision.gameObject.GetComponent <RigidHand>(); /*if(leapObj) * { * Debug.Log(leapObj.maxVelocity.magnitude); * rigidbody.AddForceAtPosition(leapObj.maxVelocity * 200, leapObj.transform.position); * * }*/ GetComponent <AudioSource>().Play(); //ScoreManage5.score5 += ScoreValue; //sound.playOneShot (); HPBar.curHealth -= 10; }
void Start() { max_hand_distance_ = 1; rigid_hand_ = GetComponent <RigidHand>(); hand_controller_ = FindObjectOfType <HandController>(); is_hand_exist_ = GetComponentInParent <IsHandExist>(); hand_pos_ = rigid_hand_.GetPalmPosition(); if (rigid_hand_.GetLeapHand().IsRight) { hand_old_pos_ = right_hand_pos_zero_; } once_position_unification_ = false; distance_difference_ = new Vector3(0.0f, 0.0f, 0.0f); }
private void Awake() { rigidHand = GetComponent <RigidHand>(); fingers = GetComponentsInChildren <RigidFinger>(true); penetrators = transform.GetComponentsInChildren <HandPenetration>(true); if (rigidHand.Handedness == Chirality.Left) { leftHandFeedback = this; } else { rightHandFeedback = this; } }
void Start() { carBodyOriginal = carBody.localPosition; carInnerOriginal = carInner.localPosition; carRoofOriginal = carRoof.localPosition; carBody_height_Max = carBodyOriginal.y + carBody_height_offset; carRoof_height_Max = carRoofOriginal.y + carRoof_height_offset; carInner_height_Max = carInnerOriginal.y + carInner_height_offset; // carWheelOriginal = carWheel_Left.localPosition; rightHand = GameObject.Find("Palm_Right").GetComponent <RigidHand>(); leftHand = GameObject.Find("Palm_Left").GetComponent <RigidHand>(); lastPosY = -10000f; }
void Start() { max_hand_distance_ = 1; rigid_hand_ = GetComponent<RigidHand>(); hand_controller_ = FindObjectOfType<HandController>(); is_hand_exist_ = GetComponentInParent<IsHandExist>(); hand_pos_ = rigid_hand_.GetPalmPosition(); if (rigid_hand_.GetLeapHand().IsLeft) { hand_old_pos_ = left_hand_pos_zero_; } once_position_unification_ = false; distance_difference_ = new Vector3(0.0f, 0.0f, 0.0f); }
public void HandGrasp(RigidHand myHand) { if (isGrasped) { return; } isGrasped = true; this.myHand = myHand; if (isHideInGrasp) { myHand.handRenderer.enabled = false; } GraspStart(myHand); }
private void Start() { HandModels = GameObject.Find("Hand Models"); //depending on handness setup controller (leap) hand and avatar hand switch (whichHand) { case Chirality.Left: hand = HandModels.transform.Find("RigidRoundHand_L").gameObject; cHand = hand.GetComponent <RigidHand>(); LeapBones = GetChildRecursive(hand); AvatarBones = GetChildRecursive(gameObject); palm = LeapBones[21]; break; case Chirality.Right: hand = HandModels.transform.Find("RigidRoundHand_R").gameObject; cHand = hand.GetComponent <RigidHand>(); LeapBones = GetChildRecursive(hand); AvatarBones = GetChildRecursive(gameObject); palm = LeapBones[21]; break; default: Debug.Log("no hands found"); break; } if (cHand == null) { Debug.LogError("Failed to find local player hand. Disabling hand preview on cilent " + PhotonNetwork.NickName); } else { Debug.Log("Local Player " + whichHand + " was set to be interaction hand" + cHand.name); } AvatarBones[1].GetComponent <SkinnedMeshRenderer>().enabled = false; for (int i = 0; i < distances.Length; i++) { distances[i] = Vector3.Distance(palm.transform.position, AvatarBones[3].transform.position); } }
public LeapHand(RigidHand hand) { this.palm = new Guidance(hand.palm); this.forearm = new Guidance(hand.forearm); this.elbowJoint = new Guidance(hand.elbowJoint); FingerModel[] fingersModel = hand.fingers; this.fingers = new Guidance[fingersModel.Length, FingerModel.NUM_JOINTS]; for (int i = 0; i < fingersModel.Length; i++) { for (int j = 0; j <= 3; ++j) { this.fingers[i, j] = new Guidance(fingersModel[i].joints[j]); } } this.handedness = hand.Handedness; }
void OnTriggerEnter(Collider other) { if(other.transform.root.name == HAND_NAME && hand == null && /*currentRotating == "" &&*/ other.CompareTag("Palm") && !scrambling){ hand = other.transform.root.GetComponent<RigidHand>(); if (hands.Contains(hand)) { hand = null; return; } handId = hand.GetLeapHand().Id; startAngle = hand.GetPalmRotation().eulerAngles; sideStartAngle = grabSide.transform.eulerAngles; canRotate = true; //swipe.enabled = false; //PalmRotator.currentRotating = name; startTime = Time.time; grabSide.transform.FindChild("Cube").gameObject.SetActive(true); } }
public override void GraspStart(RigidHand myHand) { SetMass(); this.myHand = myHand; isGrasped = true; graspBoneParent = this.transform.parent; this.GetComponent <Rigidbody>().isKinematic = true; this.transform.SetParent(myHand.transform); if (this.transform != boneRoot) { boneRoot.SetParent(this.transform); } //this.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f); Debug.Log("doll grasped"); }
public override void GraspEnd() { isRaiseMusic = false; this.mHand = null; audioPlayer.Play(); float temp = audioPlayer.clip.length - countHandlerRotation / perTimeRotation; if (temp > audioPlayer.clip.length) { audioPlayer.Stop(); } else if (temp < 0.0f) { temp = 0.0f; } audioPlayer.time = temp; Debug.Log(audioPlayer.clip.length + " musicBox " + temp); }
void OnHandGrasping(HandType handType, RigidHand myHand) { if (Input.GetKey((KeyCode.Q))) { GiveObjToHand(0, myHand); } else if (Input.GetKey(KeyCode.W)) { GiveObjToHand(1, myHand); } else if (Input.GetKey(KeyCode.E)) { GiveObjToHand(2, myHand); } else if (Input.GetKey(KeyCode.R)) { GiveObjToHand(3, myHand); } else if (Input.GetKey(KeyCode.T)) { GiveObjToHand(4, myHand); } else if (Input.GetKey(KeyCode.Y)) { GiveObjToHand(5, myHand); } else if (Input.GetKey(KeyCode.U)) { GiveObjToHand(6, myHand); } else if (Input.GetKey(KeyCode.I)) { GiveObjToHand(7, myHand); } else if (Input.GetKey(KeyCode.O)) { GiveObjToHand(8, myHand); } }
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 OnCollisionEnter(Collision collision) { RigidHand leapObj = collision.gameObject.GetComponent <RigidHand>(); /*if (leapObj) * { * Debug.Log(leapObj.maxVelocity.magnitude); * rigidbody.AddForceAtPosition(leapObj.maxVelocity * 200, leapObj.transform.position); * * }*/ //sound.playOneShot (); /*sholLeft.transform.Rotate (2.871f, 251.918f, 28.719f); * armLeft.transform.Rotate (341.354f, -47.751f, 13.842f); * sholRight.transform.Rotate (372.110f, 250.003f, 332.455f); * armRight.transform.Rotate (349.682f, -41.338f, 278.945f); */ armLeft.transform.Rotate(18.0f, 8.0f, 50.0f); //StartCoroutine (Stop ()); Destroy(bord); }
void Move(RigidHand hand, Transform fighter) { if (hand.gameObject.activeSelf) { fighter.gameObject.SetActive(true); Vector3 handPosition = hand.GetPalmPosition(); Quaternion tmp = fighter.rotation; tmp.z = -hand.GetPalmRotation().x; fighter.rotation = tmp; float newX = fighter.position.x - tmp.z * speed.x; float newY = handPosition.y * speed.y; newX = FixBoundary(newX, boundary.xMin, boundary.xMax); newY = FixBoundary(newY, boundary.yMin, boundary.yMax); fighter.position = new Vector3(newX, newY, fighter.position.z); } else { fighter.gameObject.SetActive(false); } }
void Start() { rigid_hand_ = GetComponent<RigidHand>(); left_hand_move_checker_ = GetComponent<LeftHandMoveChecker>(); right_hand_move_checker_ = GetComponent<RightHandMoveChecker>(); }
// Update is called once per frame void Update() { if(!scrambling && hand != null){ if (canRotate && startTime + TIME_DIF < Time.time && !nowRotating ) { float startDegree = rotateX ? startAngle.x : startAngle.y; float curDegree = rotateX ? hand.GetPalmRotation().eulerAngles.x : hand.GetPalmRotation().eulerAngles.y; float dir = Mathf.Sign(curDegree - startDegree); if(Mathf.Abs(curDegree - startDegree) > 30) { swipe.enabled = false; nowRotating = true; grabSide.AddCubes(); previousAngle = rotateX ? new Vector3(sideStartAngle.x, 0, 0) : new Vector3(0, sideStartAngle.y, 0); nextAngle = rotateX ? new Vector3(sideStartAngle.x + 90 * dir, 0, 0) : new Vector3(0, sideStartAngle.y + 90 * dir, 0); interp = true; canRotate = false; interTime = 0.0f; textRef.text = "Moves: " + (++moveCount); GetComponent<AudioSource>().Play(); } } Frame frame = SwipeCube.hc.Frame(); bool found = false; for (int h = 0; h < frame.Hands.Count; h++) { if (frame.Hands[h].Id == handId) { found = true; break; } } if (!found && hand != null) { if (!interp) { grabSide.RemoveCubes(); //swipe.enabled = true; } // canRotate = false; //currentHands.Remove(name); hand = null; currentRotating = ""; grabSide.transform.FindChild("Cube").gameObject.SetActive(false); } } if (interp) { if (interTime < 9.0f) { grabSide.AddCubes(); //grabSide.transform.rotation = Quaternion.Euler(Vector3.Lerp(previousAngle, nextAngle, interTime)); //interTime += (interTime > 0.5f ? 1 : 2.5f)*Time.deltaTime; grabSide.transform.RotateAround(transform.position, rotateX ? Vector3.right : Vector3.up, 10); interTime += 1; } else { grabSide.RemoveCubes(); interp = false; swipe.enabled = true; nowRotating = false; Vector3 snap = new Vector3(Mathf.Round(nextAngle.x / 90f) * 90, Mathf.Round(nextAngle.y / 90f) * 90, 0); grabSide.transform.rotation = Quaternion.Euler(snap); /***** CLEAN */ if (hand == null) { grabSide.RemoveCubes(); //swipe.enabled = true; } else { startAngle = hand.GetPalmRotation().eulerAngles; sideStartAngle = grabSide.transform.eulerAngles; canRotate = true; startTime = Time.time; } } } }