private void DoPointerDestinationSet(object sender, DestinationMarkerEventArgs e) { //if (e.controllerIndex.Equals(GetComponent<DaveControllerListener>().leftControllerIndex)) { //if (VRTK_DeviceFinder.GetControllerByIndex(e.controllerIndex) == SDK_BaseController.ControllerHand.Left) { if (VRTK_DeviceFinder.GetControllerLeftHand(false) == VRTK_DeviceFinder.GetControllerByIndex(e.controllerIndex, false)) { // dave, toggle the rigidbody of the block //GetComponent<ReporterScript>().pointerTarget = e.target.gameObject; Rigidbody r = e.target.gameObject.GetComponent <Rigidbody>(); if (r.isKinematic) { r.isKinematic = false; } else { r.isKinematic = true; } } else // let's assume it's right controller for now, dave // if it's a cube, destroy it { if (e.target.gameObject.tag.Equals("BuildingBlock")) { Destroy(e.target.gameObject); } } DebugLogger(e.controllerIndex, "POINTER DESTINATION", e.target, e.raycastHit, e.distance, e.destinationPosition); }
public void TriggerPressed(object sender, ControllerInteractionEventArgs e) { var index = VRTK_ControllerReference.GetRealIndex(e.controllerReference); controllerDevice = VRTK_DeviceFinder.GetControllerByIndex(index, true); triggerDown = true; }
private void DoButtonOnePressed(object sender, ControllerInteractionEventArgs e) { DebugLogger(e.controllerIndex, "BUTTON ONE", "pressed down", e); // now instantiate a cube in my hand if (VRTK_DeviceFinder.GetControllerLeftHand(false) == VRTK_DeviceFinder.GetControllerByIndex(e.controllerIndex, false)) { Debug.Log("left hand, dave"); } GameObject leftHand = GameObject.Find("LeftController"); GameObject block = (GameObject)Instantiate(go, VRTK_DeviceFinder.GetControllerByIndex(e.controllerIndex, false).transform.position, Quaternion.identity); }
public GameObject GetControllerByGameObject(GameObject gameObject) { GameObject obj = null; if (gameObject != null) { int index = -1; index = (int)VRTK_DeviceFinder.GetControllerIndex(gameObject); if (index > -1) { obj = VRTK_DeviceFinder.GetControllerByIndex((uint)index, false); } else { Debug.LogError("Index is -1"); } } else { Debug.LogError("Trying to get a controller from a go that has a null gameobject"); } return(obj); }
void StartMoving(object o, ControllerInteractionEventArgs e) { Debug.Log("start moving"); controller = VRTK_DeviceFinder.GetControllerByIndex(e.controllerReference.index, false).transform; audioSource.Play(); }