//Remove items that go too high or too low. protected virtual void Update() { if (this.transform.position.y > 10000 || this.transform.position.y < -10000) { if (AttachedHand != null) { AttachedHand.EndInteraction(this); } Destroy(this.gameObject); } }
//Remove items that go too high or too low. protected virtual void Update() { if (this.transform.position.y > int.MaxValue || this.transform.position.y < int.MinValue) { if (AttachedHand != null) { AttachedHand.EndInteraction(this); } Destroy(this.gameObject); } }
public void ForceDetach(NVRHand hand = null) { if (hand != null) { hand.EndInteraction(this); this.EndInteraction(hand); //hand should call this in most cases, but rarely hand / item gets disconnected on force detach } else { for (int handIndex = 0; handIndex < AttachedHands.Count; handIndex++) { AttachedHands[handIndex].EndInteraction(this); // Changed by Drew and Zach if (AttachedHands.Count > 0) { this.EndInteraction(AttachedHands[handIndex]); } else { EndInteractionWhenDestroying(); } } } }
public void ForceDetach(NVRHand hand = null) { if (hand != null) { hand.EndInteraction(this); this.EndInteraction(hand); //hand should call this in most cases, but rarely hand / item gets disconnected on force detach } else { for (int handIndex = (AttachedHands.Count - 1); handIndex >= 0; handIndex--) { NVRHand detaching = AttachedHands[handIndex]; detaching.EndInteraction(this); this.EndInteraction(detaching); } } }
// Called once one hand lets go. Aka only 1 hand is left holding on public virtual void OnSecondHandReleased(NewtonVR.NVRHand handStillHolding, NewtonVR.NVRInteractableItem nvrIItem) { // End interaction with Enemy handStillHolding.EndInteraction(nvrIItem); // Enable weapon Colliders until ready to be used foreach (Collider c in spawnedWeapon.GetComponentsInChildren <Collider>()) { c.enabled = true; } // Start Interaction with Weapon handStillHolding.BeginInteraction(spawnedWeapon.GetComponent <NewtonVR.NVRInteractable>()); // Destroy Enemy Destroy(gameObject); }
protected virtual void DroppedBecauseOfDistance(NVRHand hand) { hand.EndInteraction(this); }