private void Start() { input = gameObject.GetComponent <VrControllerInput>(); input.onGrabPressed.AddListener(OnGrabPressed); input.onGrabReleased.AddListener(OnGrabReleased); }
// Start is called before the first frame update public void Setup() { pose = gameObject.GetComponent <SteamVR_Behaviour_Pose>(); input = gameObject.GetComponent <VrControllerInput>(); collider = gameObject.GetComponent <SphereCollider>(); rigidbody = gameObject.GetComponent <Rigidbody>(); input.Setup(this); }
private void Start() { if (input == null) { bail = true; return; } switch (source) { case SteamVR_Input_Sources.LeftHand: input = VrRig.instance.LeftController.Input; break; case SteamVR_Input_Sources.RightHand: input = VrRig.instance.RightController.Input; break; default: input = VrRig.instance.LeftController.Input; break; } #region Obsolete Approach of Above // if (source == SteamVR_Input_Sources.LeftHand) // { // input = VrRig.instance.LeftController.Input; // } // else if (source == SteamVR_Input_Sources.RightHand) // { // input = VrRig.instance.RightController.Input; // } // else // { // input = VrRig.instance.LeftController.Input; // } #endregion input.onPointerPressed.AddListener(OnPointerActivate); input.onPointerReleased.AddListener(OnPointerUnactivate); input.onTeleportPressed.AddListener(OnTeleportPressed); tracer.transform.parent = transform; cursor.transform.parent = transform; tracer.SetActive(false); cursor.SetActive(false); tracerRender = tracer.GetComponent <MeshRenderer>(); cursorRender = cursor.GetComponent <MeshRenderer>(); }
private void Start() { input = gameObject.GetComponent <VrControllerInput>(); input.OnGrabPressed.AddListener((_args) => { if (collidingObject != null) { GrabObject(); } }); input.OnGrabReleased.AddListener((_args) => { if (heldObject != null) { ReleaseObject(); } }); }