public void OnRelease(VRinput hand) { Debug.Log("Release!"); transform.SetParent(null); GetComponent <Rigidbody>().useGravity = true; GetComponent <Rigidbody>().isKinematic = false; }
public void OnGrab(VRinput hand) { Debug.Log("Grab!"); transform.SetParent(hand.transform); GetComponent <Rigidbody>().useGravity = false; GetComponent <Rigidbody>().isKinematic = true; }
void Start() { controller = GetComponent <VRinput>(); if (useADV) { controller.OnGripDown.AddListener(ADVGrab); controller.OnGripUp.AddListener(ADVRelease); } else { controller.OnGripDown.AddListener(Grab); controller.OnGripUp.AddListener(Release); } }
public void OnReleaseADV(VRinput hand) { FixedJoint fx = hand.GetComponent <FixedJoint>(); Destroy(fx); }
public void OnGrabADV(VRinput hand) { FixedJoint fx = hand.gameObject.AddComponent <FixedJoint>(); fx.connectedBody = rigidBody; }
void Start() { controller = GetComponent <VRinput>(); handAnimator = GetComponentInChildren <Animator>(); }