public void UnregisterMe(GrabbableObj obj) { if (_snappedObj == obj) { _snappedObj = null; Lit(true); } }
public void DropObj(Vector3 force) { if (_grabbedObj == null) { return; } _grabbedObj.SetAttachPoint(null); _grabbedObj.StopGrabbing(force); _grabbedObj = null; }
public void EjectOtherAndRegisterMe(GrabbableObj obj) { if (_snappedObj != null) { _snappedObj.Unclip("PhotoSnap.Clip"); } _snappedObj = obj; Lit(false); }
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; } }
public void DropObj(GrabbableObj matchingObj = null) { if (_grabbedObj == null) { return; } else if (matchingObj != null && matchingObj != _grabbedObj) { return; } _grabbedObj.SetAttachPoint(null); _grabbedObj.StopGrabbing(); _grabbedObj = null; }
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; } }
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; } }
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; } }
IEnumerator GrabObjNextFrameCoroutine(GrabbableObj grabbableObj) { yield return new WaitForEndOfFrame(); GrabObj(grabbableObj); }