void Update() { if (NoloVR_Playform.GetInstance().GetPlayformError() != NoloError.None) { return; } if (showTrackingBoundary == false) { return; } var pose = NoloVR_Controller.GetDevice(NoloDeviceType.BaseStation).GetPose(); transform.localPosition = pose.pos; transform.localRotation = pose.rot; for (int i = 0; i < NoloVR_System.GetInstance().objects.Length; i++) { if (Mathf.Abs(NoloVR_System.GetInstance().objects[i].transform.localPosition.x) > Mathf.Abs(transform.position.z - NoloVR_System.GetInstance().objects[i].transform.localPosition.z) || Mathf.Abs(NoloVR_System.GetInstance().objects[i].transform.localPosition.y - transform.position.y) > Mathf.Abs(transform.position.z - NoloVR_System.GetInstance().objects[i].transform.localPosition.z + 0.1f)) { NOLO_Events.Send(NOLO_Events.EventsType.TrackingOutofRange); break; } else { NOLO_Events.Send(NOLO_Events.EventsType.TrackingInRange); } } }
void TurnAroundEventsMonitor() { //leftcontroller double click system button if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp((uint)1 << (int)turnAroundButtonType)) { if (Time.frameCount - leftcontrollerTurn_PreFrame <= turnAroundSpacingFrame) { NOLO_Events.Send(NOLO_Events.EventsType.TurnAround); leftcontrollerTurn_PreFrame = -1; } else { leftcontrollerTurn_PreFrame = Time.frameCount; } } //rightcontroller double click system button if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp((uint)1 << (int)turnAroundButtonType)) { if (Time.frameCount - rightcontrollerTurn_PreFrame <= turnAroundSpacingFrame) { NOLO_Events.Send(NOLO_Events.EventsType.TurnAround); rightcontrollerTurn_PreFrame = -1; } else { rightcontrollerTurn_PreFrame = Time.frameCount; } } }
private void Recenter() { #if NOLO_6DOF //leftcontroller double click system button if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.System)) { if (Time.frameCount - leftcontrollerRecenter_PreFrame <= recenterSpacingFrame) { UnityEngine.XR.InputTracking.Recenter(); NOLO_Events.Send(NOLO_Events.EventsType.RecenterLeft); leftcontrollerRecenter_PreFrame = -1; } else { leftcontrollerRecenter_PreFrame = Time.frameCount; } } //rightcontroller double click system button if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp(NoloButtonID.System)) { if (Time.frameCount - rightcontrollerRecenter_PreFrame <= recenterSpacingFrame) { UnityEngine.XR.InputTracking.Recenter(); NOLO_Events.Send(NOLO_Events.EventsType.RecenterRight); rightcontrollerRecenter_PreFrame = -1; } else { rightcontrollerRecenter_PreFrame = Time.frameCount; } } #elif NOLO_3DOF if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.SystemLongPress)) { UnityEngine.XR.InputTracking.Recenter(); } #endif }
void Update() { if (NoloVR_Playform.InitPlayform().GetPlayformError() != NoloError.None) { return; } transform.localPosition = new Vector3(0, -NoloVR_Plugins.GetHmdInitPosition().y, 0); //y - play ground height for (int i = 0; i < NoloVR_Manager.GetInstance().objects.Length; i++) { if (Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.x) > Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.z) || Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.y - transform.position.y) > Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.z) + 0.1f) { NOLO_Events.Send(NOLO_Events.EventsType.TrackingOutofRange); break; } else { NOLO_Events.Send(NOLO_Events.EventsType.TrackingInRange); } } }
void OnEnable() { NOLO_Events.Listen(NOLO_Events.EventsType.TrackingOutofRange, OutOfRange); NOLO_Events.Listen(NOLO_Events.EventsType.TrackingInRange, InRange); }
void OnDisable() { NOLO_Events.Remove(NOLO_Events.EventsType.TrackingOutofRange, OutOfRange); NOLO_Events.Remove(NOLO_Events.EventsType.TrackingInRange, InRange); }
public static void Remove() { NOLO_Events.Remove(NOLO_Events.EventsType.TurnAround, TurnAroundEvents); }
public static void Listen() { NOLO_Events.Listen(NOLO_Events.EventsType.TurnAround, TurnAroundEvents); }
public static void Remove() { NOLO_Events.Remove(NOLO_Events.EventsType.TurnAround, TurnAroundEvents); //NOLO_Events.Remove(NOLO_Events.EventsType.RecenterLeft, RecenterLeftEvents); //NOLO_Events.Remove(NOLO_Events.EventsType.RecenterRight, RecenterRightEvents); }
public static void Listen() { NOLO_Events.Listen(NOLO_Events.EventsType.TurnAround, TurnAroundEvents); //NOLO_Events.Listen(NOLO_Events.EventsType.RecenterLeft, RecenterLeftEvents); //NOLO_Events.Listen(NOLO_Events.EventsType.RecenterRight, RecenterRightEvents); }
//AndroidJavaClass unityPlayer; //AndroidJavaObject currentActivity; //AndroidJavaObject context; //AndroidJavaObject jc, jo; void Update() { if (Input.GetMouseButtonDown(0)) { NOLO_Events.Send(NOLO_Events.EventsType.TrackingOutofRange); } if (Input.GetMouseButtonDown(1)) { NOLO_Events.Send(NOLO_Events.EventsType.TrackingInRange); } #region right if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonDown(NoloButtonID.TouchPad)) { Debug.Log("RightController TouchPad Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonPressed(NoloButtonID.TouchPad)) { Debug.Log("RightController TouchPad Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp(NoloButtonID.TouchPad)) { Debug.Log("RightController TouchPad Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonDown(NoloButtonID.Trigger)) { Debug.Log("RightController Trigger Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonPressed(NoloButtonID.Trigger)) { Debug.Log("RightController Trigger Pressed"); NoloVR_Controller.GetDevice(NoloDeviceType.RightController).TriggerHapticPulse(100); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp(NoloButtonID.Trigger)) { Debug.Log("RightController Trigger Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonDown(NoloButtonID.System)) { Debug.Log("RightController System Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonPressed(NoloButtonID.System)) { Debug.Log("RightController System Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp(NoloButtonID.System)) { Debug.Log("RightController System Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonDown(NoloButtonID.Menu)) { Debug.Log("RightController Menu Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonPressed(NoloButtonID.Menu)) { Debug.Log("RightController Menu Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp(NoloButtonID.Menu)) { Debug.Log("RightController Menu Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonDown(NoloButtonID.Grip)) { Debug.Log("RightController Grip Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonPressed(NoloButtonID.Grip)) { Debug.Log("RightController Grip Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloButtonUp(NoloButtonID.Grip)) { Debug.Log("RightController Grip Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetNoloTouchPressed(NoloTouchID.TouchPad)) { Debug.Log(NoloVR_Controller.GetDevice(NoloDeviceType.RightController).GetAxis()); } #endregion #region left if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonDown(NoloButtonID.TouchPad)) { Debug.Log("LeftController TouchPad Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonPressed(NoloButtonID.TouchPad)) { Debug.Log("LeftController TouchPad Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.TouchPad)) { Debug.Log("LeftController TouchPad Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonDown(NoloButtonID.Trigger)) { Debug.Log("LeftController Trigger Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonPressed(NoloButtonID.Trigger)) { NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).TriggerHapticPulse(100); Debug.Log("LeftController Trigger Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.Trigger)) { Debug.Log("LeftController Trigger Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonDown(NoloButtonID.System)) { Debug.Log("LeftController System Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonPressed(NoloButtonID.System)) { Debug.Log("LeftController System Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.System)) { Debug.Log("LeftController System Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonDown(NoloButtonID.Menu)) { Debug.Log("LeftController Menu Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonPressed(NoloButtonID.Menu)) { Debug.Log("LeftController Menu Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.Menu)) { Debug.Log("LeftController Menu Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonDown(NoloButtonID.Grip)) { Debug.Log("LeftController Grip Down"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonPressed(NoloButtonID.Grip)) { Debug.Log("LeftController Grip Pressed"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloButtonUp(NoloButtonID.Grip)) { Debug.Log("LeftController Grip Up"); } if (NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetNoloTouchPressed(NoloTouchID.TouchPad)) { Debug.Log(NoloVR_Controller.GetDevice(NoloDeviceType.LeftController).GetAxis()); } #endregion }
void OnDisable() { NOLO_Events.Remove(NOLO_Events.EventsType.ConnectNoloDevice, ConnectionNOLO); }
void OnEnable() { NOLO_Events.Listen(NOLO_Events.EventsType.ConnectNoloDevice, ConnectionNOLO); }