Example #1
0
 public void OnRelease(VRinput hand)
 {
     Debug.Log("Release!");
     transform.SetParent(null);
     GetComponent <Rigidbody>().useGravity  = true;
     GetComponent <Rigidbody>().isKinematic = false;
 }
Example #2
0
 public void OnGrab(VRinput hand)
 {
     Debug.Log("Grab!");
     transform.SetParent(hand.transform);
     GetComponent <Rigidbody>().useGravity  = false;
     GetComponent <Rigidbody>().isKinematic = true;
 }
Example #3
0
    void Start()
    {
        controller = GetComponent <VRinput>();

        if (useADV)
        {
            controller.OnGripDown.AddListener(ADVGrab);
            controller.OnGripUp.AddListener(ADVRelease);
        }
        else
        {
            controller.OnGripDown.AddListener(Grab);
            controller.OnGripUp.AddListener(Release);
        }
    }
Example #4
0
    public void OnReleaseADV(VRinput hand)
    {
        FixedJoint fx = hand.GetComponent <FixedJoint>();

        Destroy(fx);
    }
Example #5
0
    public void OnGrabADV(VRinput hand)
    {
        FixedJoint fx = hand.gameObject.AddComponent <FixedJoint>();

        fx.connectedBody = rigidBody;
    }
Example #6
0
 void Start()
 {
     controller   = GetComponent <VRinput>();
     handAnimator = GetComponentInChildren <Animator>();
 }