コード例 #1
0
 private void OnTriggerStay(Collider other)
 {
     if (!item && isGripping && other.GetComponent <Grabbable>())
     {
         item = other.GetComponent <Grabbable>();
         item.Grab(this);
     }
 }
コード例 #2
0
        private void OnTriggerStay(Collider other)
        {
            // check we are not already carrying an item, we are gripping, and we found a grabbable object
            if (!item && isGripping && other.GetComponent <Grabbable>())
            {
                item = other.GetComponent <Grabbable>();

                // start grabbing
                item.Grab(gameObject);
            }
        }
コード例 #3
0
        public void Release()
        {
            isGripping = false;

            if (item)
            {
                item.Release();
            }

            item = null;
        }
コード例 #4
0
ファイル: DistanceGrabController.cs プロジェクト: Eli-P/VR_AR
        public void Grip()
        {
            isGripping = true;

            if (vrPointer.Target.transform.GetComponent <Grabbable>())
            {
                item = vrPointer.Target.transform.GetComponent <Grabbable>();
                item.Grab(grabPosition);
                item.transform.position = grabPosition.transform.position;
            }
        }
コード例 #5
0
 // release if carrying anything
 public void Release()
 {
     isGripping = false;
     item?.Release();
     item = null;
 }