Beispiel #1
0
 private bool NoArrowNotched(GameObject controller)
 {
     if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
     {
         bow = VRTK_DeviceFinder.GetControllerRightHand(true).GetComponentInChildren <BowAim>();
     }
     else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
     {
         bow = VRTK_DeviceFinder.GetControllerLeftHand(true).GetComponentInChildren <BowAim>();
     }
     return(bow == null || !bow.HasArrow());
 }
Beispiel #2
0
    private bool NoLightningAttached(GameObject controller)
    {
        if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
        {
            GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(true);
            controllerRightHand.transform.Find("LightningBoltClone");
        }
        else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
        {
            GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(true);
            controllerLeftHand.transform.Find("LightningBoltClone");
        }

        return(bow == null || !bow.HasArrow());
    }
    private void OnTriggerEnter(Collider other)
    {
        if (!other.CompareTag("PlayerHand"))
        {
            return;
        }

        if (!isUseable)
        {
            return;
        }

        isLeftActive  = VRTK_DeviceFinder.IsControllerLeftHand(other.gameObject);
        isRightActive = VRTK_DeviceFinder.IsControllerRightHand(other.gameObject);

        //if (leftGrabControl.IsGrabButtonPressed())
        //{

        //}
    }
Beispiel #4
0
 // Token: 0x06001D4F RID: 7503 RVA: 0x00095FC0 File Offset: 0x000941C0
 protected virtual Transform GetSnapHandle(GameObject grabbingObject)
 {
     if (this.rightSnapHandle == null && this.leftSnapHandle != null)
     {
         this.rightSnapHandle = this.leftSnapHandle;
     }
     if (this.leftSnapHandle == null && this.rightSnapHandle != null)
     {
         this.leftSnapHandle = this.rightSnapHandle;
     }
     if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
     {
         return(this.rightSnapHandle);
     }
     if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
     {
         return(this.leftSnapHandle);
     }
     return(null);
 }
    public static void ForeGrabGesture(GameObject grabbingObject, GameObject grabbedObject)
    {
        string name = grabbedObject.name;

        if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
        {
            GameObject GrabPos = (GameObject)ObjPoolManager.Instance.Get("OculusGestures/Left/" + name + "L", false);
            if (GrabPos != null)
            {
                _ovrAvatar.LeftHandCustomPose = GrabPos.transform;
            }
        }
        else if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
        {
            GameObject GrabPos = (GameObject)ObjPoolManager.Instance.Get("OculusGestures/Right/" + name + "R", false);
            if (GrabPos != null)
            {
                _ovrAvatar.RightHandCustomPose = GrabPos.transform;
            }
        }
    }
Beispiel #6
0
        protected virtual Transform GetSnapHandle(GameObject grabbingObject)
        {
            if (rightSnapHandle == null && leftSnapHandle != null)
            {
                rightSnapHandle = leftSnapHandle;
            }

            if (leftSnapHandle == null && rightSnapHandle != null)
            {
                leftSnapHandle = rightSnapHandle;
            }

            if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
            {
                return(rightSnapHandle);
            }

            if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
            {
                return(leftSnapHandle);
            }

            // also check to see if it is a Hand

            if (grabbingObject.GetComponent <GestureControllerEvent>() != null)
            {
                if (grabbingObject.GetComponent <GestureControllerEvent>().controllerHandId == SDK_BaseGestureLibrary.Hand.Right)
                {
                    return(rightSnapHandle);
                }

                if (grabbingObject.GetComponent <GestureControllerEvent>().controllerHandId == SDK_BaseGestureLibrary.Hand.Left)
                {
                    return(leftSnapHandle);
                }
            }

            return(null);
        }
Beispiel #7
0
 // Token: 0x06001EC0 RID: 7872 RVA: 0x0009C248 File Offset: 0x0009A448
 private bool NoArrowNotched(GameObject controller)
 {
     if (VRTK_DeviceFinder.IsControllerLeftHand(controller))
     {
         GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(true);
         this.bow = controllerRightHand.GetComponentInChildren <BowAim>();
         if (this.bow == null)
         {
             this.bow = VRTK_DeviceFinder.GetModelAliasController(controllerRightHand).GetComponentInChildren <BowAim>();
         }
     }
     else if (VRTK_DeviceFinder.IsControllerRightHand(controller))
     {
         GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(true);
         this.bow = controllerLeftHand.GetComponentInChildren <BowAim>();
         if (this.bow == null)
         {
             this.bow = VRTK_DeviceFinder.GetModelAliasController(controllerLeftHand).GetComponentInChildren <BowAim>();
         }
     }
     return(this.bow == null || !this.bow.HasArrow());
 }
        private Transform GetSnapHandle(GameObject grabbingObject)
        {
            if (rightSnapHandle == null && leftSnapHandle != null)
            {
                rightSnapHandle = leftSnapHandle;
            }

            if (leftSnapHandle == null && rightSnapHandle != null)
            {
                leftSnapHandle = rightSnapHandle;
            }

            if (VRTK_DeviceFinder.IsControllerRightHand(grabbingObject))
            {
                return(rightSnapHandle);
            }

            if (VRTK_DeviceFinder.IsControllerLeftHand(grabbingObject))
            {
                return(leftSnapHandle);
            }

            return(null);
        }
Beispiel #9
0
    //this object has been grabbed.. so do what ever is in the code
    private void ObjectGrabbed(object sender, InteractableObjectEventArgs e)
    {
        haptic_controller = GetComponent <VRTK_InteractableObject>().GetGrabbingObject();

        //set bow transform parent to controller
        bow.transform.parent = haptic_controller.transform;

        //now assign arrow hand to other controller
        if (VRTK_DeviceFinder.IsControllerRightHand(haptic_controller))
        {
            GameObject hand = VRTK_DeviceFinder.GetControllerLeftHand();
            trackedObj          = hand.GetComponentInParent <SteamVR_TrackedObject>();
            controllerReference = VRTK_ControllerReference.GetControllerReference(hand);
        }
        else
        {
            GameObject hand = VRTK_DeviceFinder.GetControllerRightHand();
            trackedObj          = hand.GetComponentInParent <SteamVR_TrackedObject>();
            controllerReference = VRTK_ControllerReference.GetControllerReference(hand);
        }


        isGrabbed = true;
    }