void OnAttachedToHand(VRHand hand) { attached = true; hand.HoverLock(null); Rigidbody rb = GetComponent <Rigidbody>(); rb.isKinematic = true; rb.interpolation = RigidbodyInterpolation.None; velocityEstimator.BeginEstimatingVelocity(); }
public override void OnInteract(XRNode hand, GameObject handObject = null, AnimationController handAnimation = null, XRNodeHandController handController = null) { inUse = true; currentHandController = handController; currentHandAnimation = handAnimation; this.transform.SetParent(handObject.transform.parent); rb.isKinematic = true; VelocityEstimator estimator = this.GetComponent <VelocityEstimator>(); if (estimator == null) { estimator = this.gameObject.AddComponent <VelocityEstimator>(); } estimator.BeginEstimatingVelocity(); if (dataReader != null) { dataReader.ApplyData(hand, currentHandAnimation, currentHandController); } OnGrab.Invoke(); }
public virtual void PickupObject(Transform pickupParent) { rb.isKinematic = true; rb.useGravity = false; pickedUp = true; vEstimator.BeginEstimatingVelocity(); transform.parent = pickupParent; }
//------------------------------------------------- protected virtual void OnAttachedToHand(Hand hand) { hadInterpolation = this.rigidbody.interpolation; attached = true; onPickUp.Invoke(); hand.HoverLock(null); rigidbody.interpolation = RigidbodyInterpolation.None; if (velocityEstimator != null) { velocityEstimator.BeginEstimatingVelocity(); } }
void Start() { ownCollider = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); ve = GetComponent <VelocityEstimator>(); ve.BeginEstimatingVelocity(); BeginDirection(); }
/// <summary> /// Recursively checks if ring has neighbours on either side and if they are attached to hand. Attaches if not yet attached /// </summary> /// <param name="hand"></param> void OnAttachedToHand(Hand hand) { // if the neighbours are already attached. the only guaranteed attach is the one a hand grabs directly attachedHand = hand; if (fishTank.ringsUseSpringConstraints) { // something } else { var attachmentFlags = Hand.AttachmentFlags.ParentToHand | Hand.AttachmentFlags.DetachFromOtherHand; if (dockedToAcceptor) { if (!partnerAcceptor.GetComponent <Ring>().attachedHand) { hand.AttachObject(partnerAcceptor, attachmentFlags); } if (fishTank.gameSettingsManager.grabSplitStack) { // if it's the end one then we don't want to attach anymore if (partnerDonor) { if (GetFurthestGo(partnerAcceptor, partnerDonor, partnerAcceptor.GetComponent <Ring>().attachedHand.gameObject) == partnerAcceptor) { hand.AttachObject(partnerAcceptor, attachmentFlags); } } } } if (dockedToDonor) { if (!partnerDonor.GetComponent <Ring>().attachedHand) { hand.AttachObject(partnerDonor, attachmentFlags); } if (fishTank.gameSettingsManager.grabSplitStack) { // if it's the end one then we don't want to attach anymore if (partnerAcceptor) { if (GetFurthestGo(partnerAcceptor, partnerDonor, partnerDonor.GetComponent <Ring>().attachedHand.gameObject) == partnerDonor) { hand.AttachObject(partnerDonor, attachmentFlags); } } } } foreach (var ao in hand.AttachedObjects) { ao.attachedObject.SetActive(true); } } velocityEstimator.BeginEstimatingVelocity(); }
protected virtual void OnAttachedToHand(Hand hand) { hand.HoverLock(null); rigidbody.interpolation = RigidbodyInterpolation.None; if (velocityEstimator != null) { velocityEstimator.BeginEstimatingVelocity(); } }
public void Collided() { print("Collideed"); ve.FinishEstimatingVelocity(); velocity = ve.GetVelocityEstimate(); stickvelocity = velocity.magnitude; if (stickvelocity < 0) { stickvelocity = stickvelocity * -1; } ve.BeginEstimatingVelocity(); }
// Use this for initialization void Start() { ownCollider = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); ve = GetComponent <VelocityEstimator>(); hj = GetComponent <HingeJoint>(); print("HINGE JOINT: " + hj.name); hj.connectedBody = hand.GetComponent <Rigidbody>(); print("Hand Position : x" + hand.transform.position.x + ", y" + hand.transform.position.y + ", z" + hand.transform.position.z); transform.position = hand.transform.position; ve.BeginEstimatingVelocity(); }
void OnTriggerEnter(Collider other) { if (other.name == "Box") { velocityEstimator.BeginEstimatingVelocity(); hitNote = null; mainManager.Vibrate(Controller, device); _Sliced hull = other.gameObject.Slice(cutPlane.transform.position, cutPlane.transform.up, crossMat); if (hull != null) { hull.CreateLowerHull(other.gameObject, crossMat); hull.CreateUpperHull(other.gameObject, crossMat); } Component[] objs = other.gameObject.transform.parent.GetComponents(typeof(Component)); //Remove Scripts foreach (Component comp in objs) { if (comp.GetType() == typeof(NoteJump)) { hitNote = comp as NoteJump; if (hitNote.note._type == handColor) { hitSpeed = velocityEstimator.speed; if (correctHit(hitNote.note._cutDirection)) { mainManager.gameManager.UpdateScore(false); } else { //Play a wrong hit sound here mainManager.gameManager.UpdateScore(true); } } else { //Play a wrong hit sound here mainManager.gameManager.UpdateScore(true); } hitNote.gameObject.SetActive(false); } } } }
public void Collided() { ve.FinishEstimatingVelocity(); velocity = ve.GetVelocityEstimate(); stickvelocity = velocity.magnitude; if (stickvelocity < 0) { stickvelocity = stickvelocity * -1; } Debug.Log("Velocity: " + stickvelocity); ve.BeginEstimatingVelocity(); hand.controller.TriggerHapticPulse(400); }
private void Update() { //velocityEstimator.FinishEstimatingVelocity(); if (checkInput()) { Debug.Log("Triggered"); //Select or Deselect if (pickedUp == null) { if (tryGetNearestFrame(out TextureBasedFrameBehaviour f)) { pickedUp = f; f.transform.SetParent(transform); f.transform.localPosition = Vector3.zero; f.transform.localRotation = Quaternion.identity; positionner.notifyFrameLift(f); velocityEstimator.BeginEstimatingVelocity(); } } else { pickedUp.transform.SetParent(null); positionner.notifyFrameDropped(pickedUp); pickedUp = null; velocityEstimator.FinishEstimatingVelocity(); } } if (pickedUp != null) { positionner.notifyFrameHandled(pickedUp); if (checkIfHit() && detectFrameHit) { //Hit frame sender?.hitFrame(pickedUp.frameID); } } //if(myInput.getTriggerPress(VRInteractionProfileManager.FRAME_PROFILE) && pickedUp != null) //{ //} }
// Use this for initialization void Start() { controllerInHand = Controller.GetComponent <SteamVR_TrackedObject>(); velocityEstimator = ControllerTip.GetComponent <VelocityEstimator>(); velocityEstimator.BeginEstimatingVelocity(); if (mainManager._currentControllers == null) { mainManager._currentControllers = new List <controller>(); } if (mainManager._currentControllers.Count >= 2) { return; } mainManager._currentControllers.Add(this); }
//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //Throwing-Functionality //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- public void setGrabbed() { isGrabbed = true; /* * if (isRecoveringFromThrow) * isRecoveringFromThrow = false; */ velocityEstimator.BeginEstimatingVelocity(); rigidbody.useGravity = false; //rigidbody.isKinematic = true; if (navAgent != null) { navAgent.enabled = false; } }
protected override void OnAttachedToHand(Hand hand) { base.OnAttachedToHand(hand); //Debug.Log("<b>[SteamVR Interaction]</b> Pickup: " + hand.GetGrabStarting().ToString()); //hadInterpolation = this.rigidbody.interpolation; attached = true; //onPickUp.Invoke(); //hand.HoverLock(null); // rigidBody.interpolation = RigidbodyInterpolation.None; velocityEstimator.BeginEstimatingVelocity(); //attachTime = Time.time; //attachPosition = transform.position; // attachRotation = transform.rotation; }
private void Awake() { velocityEstimator = ControllerTip.GetComponent <VelocityEstimator>(); velocityEstimator.BeginEstimatingVelocity(); }
void Start() { ve = GetComponent <VelocityEstimator>(); ve.BeginEstimatingVelocity(); }
void OnAttachedToHand() { dimerAttached = true; velEst.BeginEstimatingVelocity(); }