diff --git a/Assets/HOTK/Example Content/HOTK_TwitchDemoScene.unity b/Assets/HOTK/Example Content/HOTK_TwitchDemoScene.unity index 67e2daa..a9268f3 100644 Binary files a/Assets/HOTK/Example Content/HOTK_TwitchDemoScene.unity and b/Assets/HOTK/Example Content/HOTK_TwitchDemoScene.unity differ diff --git a/Assets/HOTK/Twitch/TwitchChatTester.cs b/Assets/HOTK/Twitch/TwitchChatTester.cs index d8726ef..41ebd77 100644 --- a/Assets/HOTK/Twitch/TwitchChatTester.cs +++ b/Assets/HOTK/Twitch/TwitchChatTester.cs @@ -5,6 +5,7 @@ using System.Diagnostics; using System.Linq; using UnityEngine.UI; +using Valve.VR; using Debug = UnityEngine.Debug; [RequireComponent(typeof(TwitchIRC), typeof(TextMesh))] @@ -77,6 +78,7 @@ public void Awake() public void Start() { ClearViewerCountAndChannelName("Disconnected"); + StartCoroutine("SyncWithSteamVR"); } public void ToggleConnect() @@ -111,9 +113,11 @@ public void ToggleConnect() knownFollowers.Clear(); StopCoroutine("UpdateViews"); StopCoroutine("UpdateFollowers"); + StopCoroutine("SyncWithSteamVR"); gettingInitialFollowers = true; StartCoroutine("UpdateViews"); StartCoroutine("UpdateFollowers"); + StartCoroutine("SyncWithSteamVR"); } else AddSystemNotice("Unable to Connect: Enter a Valid Channel Name!", TwitchIRC.NoticeColor.Red); } @@ -139,6 +143,19 @@ public void ToggleConnect() } } + IEnumerator SyncWithSteamVR() + { + while (Application.isPlaying) + { + var compositor = OpenVR.Compositor; + if (compositor != null) + { + var trackingSpace = compositor.GetTrackingSpace(); + SteamVR_Render.instance.trackingSpace = trackingSpace; + } + yield return new WaitForSeconds(10f); + } + } private Dictionary knownFollowers = new Dictionary(); private bool gettingInitialFollowers; diff --git a/Assets/SteamVR/Scripts/SteamVR_Render.cs b/Assets/SteamVR/Scripts/SteamVR_Render.cs index 6230de7..c24cc47 100644 --- a/Assets/SteamVR/Scripts/SteamVR_Render.cs +++ b/Assets/SteamVR/Scripts/SteamVR_Render.cs @@ -165,7 +165,8 @@ private IEnumerator RenderLoop() if (!compositor.CanRenderScene()) continue; - compositor.SetTrackingSpace(trackingSpace); + trackingSpace = compositor.GetTrackingSpace(); + compositor.SetTrackingSpace(trackingSpace); #if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) if (cameras.Length == 0) continue;