예제 #1
0
 public void UnregisterMe(GrabbableObj obj)
 {
     if (_snappedObj == obj)
     {
         _snappedObj = null;
         Lit(true);
     }
 }
예제 #2
0
    public void DropObj(Vector3 force)
    {
        if (_grabbedObj == null)
        {
            return;
        }

        _grabbedObj.SetAttachPoint(null);
        _grabbedObj.StopGrabbing(force);
        _grabbedObj = null;
    }
예제 #3
0
    public void EjectOtherAndRegisterMe(GrabbableObj obj)
    {
        if (_snappedObj != null)
        {
            _snappedObj.Unclip("PhotoSnap.Clip");
        }

        _snappedObj = obj;

        Lit(false);
    }
예제 #4
0
    void OnTriggerExit(Collider collider)
    {
        GrabbableObj obj = collider.attachedRigidbody.gameObject.GetComponent<GrabbableObj>();
        if (obj == objNearHand)
            objNearHand = null;

        Flamable fmb = collider.gameObject.GetComponent<Flamable>();
        if (fmb == fireNearHand)
        {
            fireNearHand = null;
        }
    }
예제 #5
0
    public void DropObj(GrabbableObj matchingObj = null)
    {
        if (_grabbedObj == null)
        {
            return;
        }
        else if (matchingObj != null && matchingObj != _grabbedObj)
        {
            return;
        }

        _grabbedObj.SetAttachPoint(null);
        _grabbedObj.StopGrabbing();
        _grabbedObj = null;
    }
예제 #6
0
    public void DropObjBis()
    {
        if (_grabbedObj == null)
        {
            return;
        }

        SteamVR_Controller.Device device = SteamVR_Controller.Input((int)_trackedObj.index);

        if (device != null)
        {
            _grabbedObj.SetAttachPoint(null);
            _grabbedObj.StopGrabbingBis(device.velocity, device.angularVelocity);
            //_grabbedObj.Unclip(this.name);
            _grabbedObj = null;
        }
    }
예제 #7
0
 void OnTriggerEnter(Collider collider)
 {
     //DebugConsole.dc.AddLine("OnTriggerEnterCalled");
     GrabbableObj obj = collider.attachedRigidbody.gameObject.GetComponent<GrabbableObj>();
     if (obj != null && joint == null)// && device.GetTouchDown(SteamVR_Controller.ButtonMask.Trigger))
     {
         objNearHand = obj;
         /*if (obj.shouldSnap)
         {
             obj.rb.position = attachPoint.position;
             obj.rb.rotation = attachPoint.rotation;
         }
         //DebugConsole.dc.AddLine("Should have grabbed");
         joint = gameObject.AddComponent<FixedJoint>();
         joint.connectedBody = obj.rb;
         obj.OnGrab();*/
     }
     Flamable fmb = collider.gameObject.GetComponent<Flamable>();
     if (fmb != null)
     {
         fireNearHand = fmb;
     }
 }
예제 #8
0
 private void GrabObj(GrabbableObj grabbableObj)
 {
     if (grabbableObj.StartGrabbing(this.transform))
     {
         grabbableObj.SetAttachPoint(_attachPoint);
         //grabbableObj.Clip(_anchor, this.name);
         this.DropObj();
         _otherHand.DropObj(grabbableObj);
         _grabbedObj = grabbableObj;
     }
 }
예제 #9
0
    IEnumerator GrabObjNextFrameCoroutine(GrabbableObj grabbableObj)
    {
        yield return new WaitForEndOfFrame();

        GrabObj(grabbableObj);
    }