protected virtual void HandAttachedUpdate(IF_VR_Steam_Hand hand)
        {
            UpdateLinearMapping(hand.transform);

            if (hand.IsGrabEnding(this.gameObject))
            {
                hand.DetachObject(gameObject);
            }
        }
 //-------------------------------------------------
 private void RemoveMatchingItemTypesFromHand(IF_VR_Steam_ItemPackage.ItemPackageType packageType, IF_VR_Steam_Hand hand)
 {
     for (int i = 0; i < hand.AttachedObjects.Count; i++)
     {
         IF_VR_Steam_ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent <IF_VR_Steam_ItemPackageReference>();
         if (packageReference != null)
         {
             if (packageReference.itemPackage.packageType == packageType)
             {
                 GameObject detachedItem = hand.AttachedObjects[i].attachedObject;
                 hand.DetachObject(detachedItem);
             }
         }
     }
 }
        protected virtual void OnDestroy()
        {
            isDestroying = true;

            if (attachedToHand != null)
            {
                attachedToHand.DetachObject(this.gameObject, false);
                attachedToHand.skeleton.BlendToSkeleton(0.1f);
            }

            if (highlightHolder != null)
            {
                Destroy(highlightHolder);
            }

            onDestroy?.Invoke(this);
        }
예제 #4
0
        //-------------------------------------------------
        protected virtual void HandAttachedUpdate(IF_VR_Steam_Hand hand)
        {
            if (hand.IsGrabEnding(this.gameObject))
            {
                hand.DetachObject(gameObject, restoreOriginalParent);

                // Uncomment to detach ourselves late in the frame.
                // This is so that any vehicles the player is attached to
                // have a chance to finish updating themselves.
                // If we detach now, our position could be behind what it
                // will be at the end of the frame, and the object may appear
                // to teleport behind the hand when the player releases it.
                //StartCoroutine( LateDetach( hand ) );
            }

            if (onHeldUpdate != null)
            {
                onHeldUpdate.Invoke(hand);
            }
        }
        //-------------------------------------------------
        private void RemoveMatchingItemsFromHandStack(IF_VR_Steam_ItemPackage package, IF_VR_Steam_Hand hand)
        {
            if (hand == null)
            {
                return;
            }

            for (int i = 0; i < hand.AttachedObjects.Count; i++)
            {
                IF_VR_Steam_ItemPackageReference packageReference = hand.AttachedObjects[i].attachedObject.GetComponent <IF_VR_Steam_ItemPackageReference>();
                if (packageReference != null)
                {
                    IF_VR_Steam_ItemPackage attachedObjectItemPackage = packageReference.itemPackage;
                    if ((attachedObjectItemPackage != null) && (attachedObjectItemPackage == package))
                    {
                        GameObject detachedItem = hand.AttachedObjects[i].attachedObject;
                        hand.DetachObject(detachedItem);
                    }
                }
            }
        }
예제 #6
0
        //-------------------------------------------------
        protected virtual IEnumerator LateDetach(IF_VR_Steam_Hand hand)
        {
            yield return(new WaitForEndOfFrame());

            hand.DetachObject(gameObject, restoreOriginalParent);
        }