// Update is called once per frame void Update() { if (RayFromCamera.ObjectLookAt() != null && teleport.CanTeleport) { //Debug.Log(Pose.GetLocalPosition(HandType).y + " " + Pose.GetVelocity(HandType).y); GameObject obj = RayFromCamera.ObjectLookAt(); //if (Pose.GetLocalPosition(HandType).y <= teleport.heightRequired && // (Pose.GetLastLocalPosition(HandType).y - Pose.GetLocalPosition(HandType).y) > 0 && // (Pose.GetLastVelocity(HandType).y - Pose.GetVelocity(HandType).y) > 0 && // Pose.GetVelocity(HandType).y <= teleport.speedRequired) //if((Pose.GetVelocity(HandType).y > 1 && Pose.GetLocalPosition(HandType).y > 0.1f) || Trigger.GetStateDown(SteamVR_Input_Sources.Any)) if (Pose.GetLocalPosition(HandType).y <= teleport.heightRequired && (Pose.GetLastLocalPosition(HandType).y - Pose.GetLocalPosition(HandType).y) > 0 && (Pose.GetLastVelocity(HandType).y - Pose.GetVelocity(HandType).y) > 0 && Pose.GetVelocity(HandType).y <= teleport.speedRequired) { teleport.Begin(obj); teleport.CanTeleport = false; } } //ShowTargetObject(); }
// Update is called once per frame void Update() { if (isTouched == true && grab.GetStateDown(hand)) { grabObject.GetComponent <Rigidbody>().isKinematic = true; grabObject.SetParent(this.transform); } if (isTouched == true && grab.GetStateUp(hand)) { grabObject.SetParent(null); grabObject.GetComponent <Rigidbody>().isKinematic = false; grabObject.GetComponent <Rigidbody>().velocity = pose.GetLastVelocity(hand); isTouched = false; grabObject = null; } }
void DoGetVelocity() { switch (velocityType) { case setVelocityType.getVelocity: velocity = poseAction.GetVelocity(device); break; case setVelocityType.getLastStateVelocity: velocity = poseAction.GetLastVelocity(device); break; } vector.Value = velocity; x.Value = velocity.x; y.Value = velocity.y; z.Value = velocity.z; }