/// <summary> /// Finds the Omni so we can start reading data. /// </summary> public virtual void OmniInitialize() { if (developerMode) { if (cameraReference == null) { Debug.LogError("Camera Reference not set in prefab."); return; } if (!VRDevice.isPresent) { cameraReference.gameObject.AddComponent <SmoothMouseLook>(); } return; } // Create a new OmniManager and see if we can find the Omni omniManager = new OmniManager(); if (omniManager.FindOmni()) { byte[] logMotionData = OmniCommon.OmniPacketBuilder.buildPacket((byte)OmniCommon.Command.SET_MOTION_DATA_MODE, new byte[] { 0x7F }, 0x00); omniManager.SendData(logMotionData); omniFound = true; } else { Debug.LogError("Virtuix Omni not found."); omniFound = false; return; } }
/// <summary> /// Finds the Omni so we can start reading data. /// </summary> public virtual void OmniInitialize() { if (developerMode) { if (cameraReference == null) { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniMovementComponent(OmniInitialize) - Attempted to Initialize the Omni - developer mode is true and Camera Reference not set in prefab."); return; } if (!UnityEngine.XR.XRDevice.isPresent) { cameraReference.gameObject.AddComponent <SmoothMouseLook>(); Vector3 adjustedCameraPosition = cameraReference.localPosition; adjustedCameraPosition.y = 1.5f; cameraReference.localPosition = adjustedCameraPosition; } return; } // Create a new OmniManager and see if we can find the Omni omniManager = new OmniManager(); if (omniManager.FindOmni()) { Debug.Log(System.DateTime.Now.ToLongTimeString() + ": OmniMovementComponent(OmniInitialize) - Successfully found the Omni."); omniFound = true; } else { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniMovementComponent(OmniInitialize) - Attempted to Initialize the Omni, but Omni not found."); omniFound = false; return; } }
void StopOmni() { if (omniManager != null) { omniManager.Cleanup(); omniManager = null; } }
public override void OmniInitialize() { if (viveCameraRigPrefab == null && cameraReference == null) { Debug.LogError("SteamVROmniController(OmniInitialize) - Prefab needs to be set to the SteamVR [CameraRig] from the SteamVR Prefabs folder"); return; } if (cameraReference == null) { GameObject viveRig = Instantiate(viveCameraRigPrefab, viveRootObject.transform.position, viveRootObject.transform.rotation) as GameObject; viveRig.transform.parent = viveRootObject; } cameraReference = GameObject.Find("Camera (eye)").transform; debugTextUI.gameObject.transform.parent.parent = cameraReference; if (developerMode) { if (cameraReference == null) { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": SteamVROmniController(OmniInitialize) - Attempted to Initialize the Omni - developer mode is true and Camera Reference not set in prefab."); return; } if (SteamVR.instance == null) { cameraReference.gameObject.AddComponent <SmoothMouseLook>(); } viveRootObject.localPosition = new Vector3(0, 1, 0); return; } // Create a new OmniManager and see if we can find the Omni if (omniManager == null) { omniManager = new OmniManager(); } if (omniManager.FindOmni()) { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": SteamVROmniController(OmniInitialize) - Successfully found the Omni."); byte[] logMotionData = OmniCommon.OmniPacketBuilder.buildPacket((byte)OmniCommon.Command.SET_MOTION_DATA_MODE, new byte[] { 0x7F }, 0x00); omniManager.SendData(logMotionData); omniFound = true; } else { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": SteamVROmniController(OmniInitialize) - Attempted to Initialize the Omni, but Omni not found."); omniFound = false; return; } }
void AttemptToReconnectTheOmni() { if (omniManager == null) { omniManager = new OmniManager(); } if (!omniManager.omniDisconnected) { return; } OmniInitialize(); }
public static IApplicationBuilder UseOmni(this IApplicationBuilder app) { if (app == null) { throw new ArgumentNullException($"{nameof(app)} cannot be null."); } if (app.ApplicationServices == null) { throw new ArgumentException("Your application builder does not have a service manager."); } OmniManager.SetupInstance(app.ApplicationServices); return(app); }
/// <summary> /// Finds the Omni so we can start reading data. /// </summary> public virtual void OmniInitialize() { if (developerMode) { if (cameraReference == null) { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniController(OmniInitialize) - Attempted to Initialize the Omni - developer mode is true and Camera Reference not set in prefab."); return; } if (!VRDevice.isPresent) { cameraReference.gameObject.AddComponent <SmoothMouseLook>(); } return; } // Create a new OmniManager and see if we can find the Omni if (omniManager == null) { omniManager = new OmniManager(); } if (omniManager.FindOmni()) { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniController(OmniInitialize) - Successfully found the Omni."); byte[] logMotionData = OmniCommon.OmniPacketBuilder.buildPacket((byte)OmniCommon.Command.SET_MOTION_DATA_MODE, new byte[] { 0x7F }, 0x00); omniManager.SendData(logMotionData); omniFound = true; } else { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniController(OmniInitialize) - Attempted to Initialize the Omni, but Omni not found."); omniFound = false; return; } }
void AttemptToReconnectTheOmni() { if (omniManager == null) { omniManager = new OmniManager(); } if (!omniManager.omniDisconnected) { return; } if (omniManager.FindOmni()) { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniMovementComponent(AttemptToReconnectTheOmni) - Successfully found the Omni for reconnect."); omniFound = true; } else { Debug.LogError(System.DateTime.Now.ToLongTimeString() + ": OmniMovementComponent(AttemptToReconnectTheOmni) - Attempted to Reconnect the Omni, but Omni not found."); omniFound = false; return; } }