예제 #1
0
 public void grabWorld(ViveGrip_GripPoint grip)
 {
     Debug.Log("grabbing the world");
     //attach the world
     //grip.grabber.OverrideGrabWith(grip, GetComponent<Rigidbody>());
     //grip.GrabObject(gameObject);
 }
예제 #2
0
    void GrabWith(ViveGrip_GripPoint gripPoint)
    {
        Rigidbody desiredBody = gripPoint.TouchedObject().GetComponent <Rigidbody>();

        desiredBody.gameObject.GetComponent <ViveGrip_Grabbable>().GrabFrom(transform.position);
        joint = ViveGrip_JointFactory.JointToConnect(jointObject, desiredBody, transform.rotation);
    }
예제 #3
0
    public void RebuildJoint()
    {
        ViveGrip_GripPoint gripPoint = GetComponent <ViveGrip_GripPoint>();

        ViveGripGrabStop(gripPoint);
        ViveGripGrabStart(gripPoint);
    }
예제 #4
0
 void ViveGripHighlightStart(ViveGrip_GripPoint gripPoint)
 {
     if (!this.enabled)
     {
         return;
     }
     grips.Add(gripPoint);
 }
 void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
 {
     try{
         attachedGripPoints.Remove(gripPoint);
     }
     catch (Exception e) {
     }
 }
예제 #6
0
 void ViveGripInteractionStop(ViveGrip_GripPoint _gp)
 {
     bob.SetActive(true);
     this.gameObject.transform.parent   = homeParent;
     this.gameObject.transform.position = home.transform.position;
     this.gameObject.transform.rotation = home.transform.rotation;
     isHeld = false;
 }
예제 #7
0
 void ViveGripTouchStop(ViveGrip_GripPoint gripPoint)
 {
     // We might move out of touch range but still be holding something
     if (!gripPoint.HoldingSomething())
     {
         GetComponent <MeshFilter>().mesh = rest;
     }
 }
 void ViveGripInteractionStart(ViveGrip_GripPoint gripPoint)
 {
     if (gripPoint.HoldingSomething())
     {
         bubbling   = true;
         controller = gripPoint.controller;
     }
 }
예제 #9
0
 void ViveGripInteractionStart(ViveGrip_GripPoint gripPoint)
 {
     //if (gripPoint.HoldingSomething())
     //{
     //    controller = gripPoint.controller;
     //}
     //controller = gripPoint.controller;
 }
예제 #10
0
 void ViveGripHighlightStop(ViveGrip_GripPoint gripPoint)
 {
     if (!this.enabled)
     {
         return;
     }
     grips.Remove(gripPoint);
 }
 void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
 {
     if (!this.enabled)
     {
         return;
     }
     Destroy(jointObject);
 }
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     if (!this.enabled)
     {
         return;
     }
     jointObject = InstantiateJointParent();
     GrabWith(gripPoint);
 }
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     try{
         attachedGripPoints.Add(gripPoint);
     }
     catch (Exception e) {
     }
     Debug.Log("Held");
 }
예제 #14
0
 void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
 {
     StopCoroutine("FadeOut");
     StartCoroutine("FadeIn");
     // We're not always touching something when we stop grabbing
     if (!gripPoint.TouchingSomething())
     {
         GetComponent <MeshFilter>().mesh = rest;
     }
 }
예제 #15
0
    void ViveGripTouchStop(ViveGrip_GripPoint gripPoint)
    {
        // We might move out of touch range but still be holding something
        if (!gripPoint.HoldingSomething())
        {
            //GetComponent<MeshFilter>().mesh = rest;

            restHand.SetActive(true);
            primedHand.SetActive(false);
        }
    }
 void ViveGripTouchStart(ViveGrip_GripPoint gripPoint)
 {
     if (gripPoint.HoldingSomething())
     {
         return;
     }
     gripPoint.ToggleGrab();
     attachedGripPoint = gripPoint;
     gripPoint.enabled = false;
     attached          = false;
 }
예제 #17
0
/*------------------------injects*/
    void ViveGripAirGrabStart(ViveGrip_GripPoint gripPoint)
    {
        Debug.Log("grabber ViveGripAirGrabStart");

        if (gripPoint.airGrabbingTarget != null)
        {
            jointObject = InstantiateJointParent();
            Rigidbody desiredBody = gripPoint.airGrabbingTarget.GetComponent <Rigidbody>();
            gripPoint.airGrabbingTarget.GetComponent <ViveGrip_Grabbable>().GrabFrom(transform.position);
            joint = ViveGrip_JointFactory.JointToConnect(jointObject, desiredBody, transform.rotation);
        }
    }
 void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
 {
     if (!this.enabled)
     {
         return;
     }
     if (counter <= 0)
     {
         return;
     }
     gripPoint.ToggleGrab();
 }
예제 #19
0
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     if (this.GetComponent <Rigidbody> ().isKinematic)
     {
         this.GetComponent <Rigidbody> ().isKinematic = false;
         this.GetComponent <MeshCollider> ().enabled  = false;
     }
     try{
         attachedGripPoints.Add(gripPoint);
     }
     catch (Exception e) {
     }
 }
예제 #20
0
 void ViveGripInteractionStart(ViveGrip_GripPoint _gp)
 {
     gp     = _gp;
     hand   = gp.GetComponentInParent <SteamVR_TrackedObject>();
     device = SteamVR_Controller.Input((int)hand.index);
     device.TriggerHapticPulse(500);
     this.gameObject.transform.parent           = gp.transform;
     this.gameObject.transform.localPosition    = grabbedPosition;
     this.gameObject.transform.localEulerAngles = grabbedRotation;
     bob = gp.transform.parent.Find("Model").gameObject;
     bob.SetActive(false);
     isHeld = true;
 }
예제 #21
0
 void ViveGripInteractionStart(ViveGrip_GripPoint gp)
 {
     if (this.name == "lefthandles")
     {
         HCC.leftGripped = true;
         onLeft          = true;
     }
     if (this.name == "righthandles")
     {
         HCC.rightGripped = true;
         onRight          = true;
     }
 }
    void Update()
    {
        if (attachedGripPoint == null)
        {
            return;
        }
        float speed = GetComponent <Rigidbody>().velocity.magnitude;

        attached = attached || speed < SPEED_THRESHOLD;
        if (attached && speed > SPEED_THRESHOLD)
        {
            attachedGripPoint.enabled = true;
            attachedGripPoint.ToggleGrab();
            attachedGripPoint = null;
        }
    }
예제 #23
0
    void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
    {
        if (shouldItBeKinematicOnRelease)
        {
            if (this.GetComponent <Rigidbody>() != null)
            {
                this.GetComponent <Rigidbody>().isKinematic = true;
            }
        }

        try{
            attachedGripPoints.Remove(gripPoint);
        }
        catch (Exception e) {
        }
    }
예제 #24
0
 void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
 {
     Destroy(jointObject);
 }
예제 #25
0
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     controller = gripPoint.controller;
     leverRigidBody.isKinematic = false;
 }
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     controller = gripPoint.controller;
 }
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     controller = gripPoint.controller;
     otherHandle.isKinematic = false;
     thisHandle.isKinematic  = false;
 }
예제 #28
0
 void ViveGripInteractionStart(ViveGrip_GripPoint gripPoint)
 {
     gripPoint.controller.Vibrate(25, 0.4f);
     GetComponent <ViveGrip_Interactable>().enabled = false;
     StartCoroutine("Move");
 }
예제 #29
0
 void ViveGripGrabStop(ViveGrip_GripPoint gripPoint)
 {
     Debug.Log("grabber ViveGripGrabStop");
     Destroy(jointObject);
 }
예제 #30
0
 void ViveGripGrabStart(ViveGrip_GripPoint gripPoint)
 {
     Debug.Log("grabber ViveGripGrabStart");
     jointObject = InstantiateJointParent();
     GrabWith(gripPoint);
 }