// turn control on and off public void setState(bool state, ViveControllerModule.EventData eventData) { if (isActivated == state) { return; } Action <GameObject, ViveControllerModule.EventData> value; // execute the function if (pressPairings.TryGetValue(state, out value)) { if (value != null) { value(obj, eventData); } } else { Console.WriteLine("Key =" + state + " is not found."); } isActivated = state; drawMenuLabels(); }
void IGlobalTriggerClickHandler.OnGlobalTriggerClick(ViveControllerModule.EventData eventData) { if (eventData.currentRaycast != null && eventData.currentRaycast.GetComponent <DOOObject>().type == DOOType.FLOOR) { Teleport(eventData.worldPosition); } }
/// <summary> /// Take the event data values from PAD Touch and use radians to return a mapped from DIRECTION ENUM /// </summary> /// <param name="eventData"></param> /// <returns></returns> public DIRECTION ParseDirection(ViveControllerModule.EventData eventData) { // 0.1875 double rad = Math.Atan2(eventData.touchpadAxis.y, eventData.touchpadAxis.x); // value used to map ranges for each direction // TODO: move this somewhere double range = 0.375; double radianDelta = 2.75; // sort dictionary according to ranges // we are using a range +- range variable above and finding if our radian is between that range. foreach (var item in padValueMap.Where(item => { var bottomvalue = (item.Value - range); var topvalue = (item.Value + range); //Debug.Log("key " + item.Key + " val " + item.Value + " rad " + rad + "bottom " + bottomvalue + " top " + topvalue); // if we reach the top reverse the ranges only applies to one value if (rad > radianDelta) { return(-topvalue < rad && rad < -bottomvalue); } else { return(bottomvalue < rad && rad < topvalue); } }).ToList()) { // Debug.Log(item.Key); return(item.Key); } ; return(DIRECTION.NONE); }
// trigger the action public EditingOjbect trigger(GameObject _obj, ViveControllerModule.EventData eventData) { if (!isActivated) { return(null); } Action <GameObject, ViveControllerModule.EventData> value; // execute the function if (pressPairings.TryGetValue(true, out value)) { if (value != null) { value(_obj, eventData); return(new EditingOjbect(_obj, this.menuEditState)); } else { return(null); } } else { Console.WriteLine("Key =" + true + " is not found."); return(null); } }
public void OnGlobalTouchpadTouch(ViveControllerModule.EventData eventData) { //if(currenteditingobject !=null) //{ // //debug.log(currenteditingobject.editstate); // //debug.log(parseangle(eventdata)); // if (currenteditingobject.selectedobject != null) // { // debug.log("rotate"); // // currenteditingobject.selectedobject.transform.rotate(vector3.up, currenteditingobject.selectedobject.transform.rotation.eulerangles.y + (float)parseangle(eventdata)); // // leantween.rotatearound(currenteditingobject.selectedobject, vector3.up, 5, 0.1f); // } //} if (eventData.viveControllerModule.Controller.index == leftcontrollerid) { // Debug.Log("left"); leftmenuui.setHover(ParseDirection(eventData)); //submenu.trigger(eventData.currentRaycast.gameObject, eventData); //left } else { // Debug.Log("right"); rightmenuui.setHover(ParseDirection(eventData)); }; }
void FixedUpdate() { if (receiver.module == null) { Debug.LogError("TeleportController " + name + " does not have a module. It requires a module."); } ViveControllerModule.EventData eventData = (receiver.module as ViveControllerModule).GetEventData(); if (eventData != null && eventData.currentRaycast != null) { if (eventData.currentRaycast.GetComponent <TeleportLocation>() != null) { EnableCursorAndLine(eventData, validCastColor); } else { cursor.SetActive(false); // EnableCursorAndLine(eventData, invalidCastColor); } } else { // Debug.Log("no raycast"); DisableCursorAndLine(); } }
/// <summary> /// This function is called when the trigger is released. Called once per press context. /// </summary> /// <param name="eventData">The corresponding event data for the module.</param> public void OnGlobalTriggerPressUp(ViveControllerModule.EventData eventData) { //If the grabbing module releases it's trigger, unbind it from this object. if (grabbingModule == eventData.viveControllerModule) { Release(eventData.viveControllerModule); } }
void IPointerTriggerPressUpHandler.OnPointerTriggerPressUp(ViveControllerModule.EventData eventData) { //If the grabbing module releases it's trigger, unbind it from this object. if (grabbingModule == eventData.viveControllerModule) { Release(eventData.viveControllerModule); } }
void IPointerTriggerPressHandler.OnPointerTriggerPress(ViveControllerModule.EventData eventData) { //Only accept this call if it's from the module currently grabbing this object. if (grabbingModule == eventData.viveControllerModule) { //Check for a GlobalGrabber if this object should expect one. Hold(eventData.viveControllerModule); } }
public void OnGlobalTouchpadPressDown(ViveControllerModule.EventData eventData) { transform.position = eventData.module.gameObject.transform.position; Vector3 updatedrotation = transform.rotation.eulerAngles; updatedrotation.y = eventData.module.gameObject.transform.rotation.eulerAngles.y; transform.rotation = Quaternion.Euler(updatedrotation); transform.LookAt(eventData.module.transform); }
void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData) { //Only "grab" the object if it's within the bounds of the object. //If the object has already been grabbed, ignore this event call. if (grabbingModule == null && pointerGrab) { //Check for a GlobalGrabber if this object should expect one. Grab(eventData.viveControllerModule); } }
/// <summary> /// This function is called when the trigger is initially pressed. Called once per press context. /// </summary> /// <param name="eventData">The corresponding event data for the module.</param> public void OnGlobalTriggerPressDown(ViveControllerModule.EventData eventData) { //Only "grab" the object if it's within the bounds of the object. //If the object has already been grabbed, ignore this event call. if (collider.bounds.Contains(eventData.viveControllerModule.transform.position) && grabbingModule == null && colliderGrab) { //Check for a GlobalGrabber if this object should expect one. Grab(eventData.viveControllerModule); } }
void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData) { if (!inUse) { GetComponent <Image>().color = ApplicationConfig.Instance.MENULOADINGCOLOR; WorldContentManager.Instance.AddObject(index.ToString(), index, transform); inUse = true; } //ObjectFactory.Instance.triggerPrefab(index, transform.position); }
public void OnGlobalGripPressDown(ViveControllerModule.EventData eventData) { if (eventData.viveControllerModule.Controller.index == leftcontrollerid) { Debug.Log("left"); //left } else { Debug.Log("right"); }; }
public void OnGlobalTouchpadPressDown(ViveControllerModule.EventData eventData) { //is left menu if (eventData.viveControllerModule.Controller.index == leftcontrollerid) { DOOType type = eventData.currentRaycast.gameObject.GetComponentInChildren <DOOObject>().type; // find matching main menu from DOO type MenuItem mainmenu; if (leftMenuMap.TryGetValue(type, out mainmenu)) { //find matching submenu from Direction MenuItem submenu; if (mainmenu.submenuitems.TryGetValue(ParseDirection(eventData), out submenu)) { currentEditingObject = submenu.trigger(eventData.currentRaycast.gameObject, eventData); mainmenu.ui.setSelected(ParseDirection(eventData)); } else { Debug.Log("no action bro"); } } else { //no menu found } } // no its actually right menu else { //find matching submenu from Direction MenuItem submenu; if (rightmenu.submenuitems.TryGetValue(ParseDirection(eventData), out submenu)) { submenu.trigger(MainMenuManager.Instance.gameObject, eventData); //rightmenu.ui.setSelected(ParseDirection(eventData)); } else { Debug.Log("no action bro"); } } }
void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData) { inputManager.textEntry = GetComponent <UnityEngine.UI.InputField>(); inputManager.ShowKeyboard(Title); }
public double ParseAngle(ViveControllerModule.EventData eventData) { double rad = Math.Atan2(eventData.touchpadAxis.y, eventData.touchpadAxis.x); return(rad * Mathf.Rad2Deg); }
void IPointerTriggerPressDownHandler.OnPointerTriggerPressDown(ViveControllerModule.EventData eventData) { Debug.Log("load room"); loadroom(); }
void IPointerTriggerClickHandler.OnPointerTriggerClick(ViveControllerModule.EventData eventData) { Debug.Log("Pointer Trigger Click from module: " + eventData.viveControllerModule.name); }
public void OnGlobalTouchpadTouch(ViveControllerModule.EventData eventData) { // Debug.Log(eventData.touchpadAxis); }
public void OnPointerTriggerPressUp(ViveControllerModule.EventData eventData) { //throw new NotImplementedException(); }
public void OnPointerTriggerPressDown(ViveControllerModule.EventData eventData) { moveObject(eventData.worldPosition, axis); }
public void OnGlobalTriggerClick(ViveControllerModule.EventData eventData) { Debug.Log("Global Trigger Click from module: " + eventData.viveControllerModule.name); }
void IGlobalTouchpadPressHandler.OnGlobalTouchpadPress(ViveControllerModule.EventData eventData) { Debug.Log("menu"); }