コード例 #1
0
 private void GrabInteractedObject()
 {
     if (controllerAttachJoint == null && grabbedObject == null && IsObjectGrabbable(interactTouch.GetTouchedObject()))
     {
         InitGrabbedObject();
         SnapObjectToGrabToController(grabbedObject);
     }
 }
コード例 #2
0
 void UseInteractedObject()
 {
     if (usingObject == null && IsObjectUsable(interactTouch.GetTouchedObject()))
     {
         usingObject = interactTouch.GetTouchedObject();
         OnControllerUseInteractableObject(interactTouch.SetControllerInteractEvent(usingObject));
         usingObject.GetComponent <SteamVR_InteractableObject>().StartUsing(this.gameObject);
         if (hideControllerOnUse)
         {
             trackedController.ToggleControllerModel(false);
         }
     }
 }
コード例 #3
0
    void GrabInteractedObject()
    {
        if (controllerAttachJoint == null && grabbedObject == null && IsObjectGrabbable(interactTouch.GetTouchedObject()))
        {
            grabbedObject = interactTouch.GetTouchedObject();
            OnControllerGrabInteractableObject(interactTouch.SetControllerInteractEvent(grabbedObject));
            grabbedObject.GetComponent <SteamVR_InteractableObject>().Grabbed(this.gameObject);
            if (hideControllerOnGrab)
            {
                trackedController.ToggleControllerModel(false);
            }

            SnapObjectToGrabToController(grabbedObject);
        }
    }
コード例 #4
0
    private void GrabInteractedObject()
    {
        if (grabbedObject == null && IsObjectGrabbable(interactTouch.GetTouchedObject()))
        {
            grabbedObject = interactTouch.GetTouchedObject();
            OnControllerGrabInteractableObject(interactTouch.SetControllerInteractEvent(grabbedObject));
            grabbedObject.GetComponent <SteamVR_InteractableObject>().Grabbed(this.gameObject);
            if (hideControllerOnGrab)
            {
                controllerActions.ToggleControllerModel(false);
            }

            Debug.Log("Grabbed");

            startWorld = world.transform.position;
            startPos   = trackedController.transform.position;
        }
    }
コード例 #5
0
    private void DoStartUseObject(object sender, ControllerClickedEventArgs e)
    {
        GameObject touchedObject = interactTouch.GetTouchedObject();

        if (touchedObject != null && interactTouch.IsObjectInteractable(touchedObject))
        {
            UseInteractedObject(touchedObject);
            if (!IsObjectHoldOnUse(usingObject))
            {
                SetObjectUsingState(usingObject, GetObjectUsingState(usingObject) + 1);
            }
        }
    }