diff --git a/Assets/Scripts/TES/Components/PlayerVRComponent.cs b/Assets/Scripts/TES/Components/PlayerVRComponent.cs index b7de7e0..a17ba2c 100644 --- a/Assets/Scripts/TES/Components/PlayerVRComponent.cs +++ b/Assets/Scripts/TES/Components/PlayerVRComponent.cs @@ -125,11 +125,8 @@ void Update() /// /// Recenter the Main UI. /// - /// - private IEnumerator RecenterUI() + private void RecenterUI() { - yield return new WaitForSeconds(0.1f); - if (_vrVendor != VRVendor.None) { var pivotRot = _pivotCanvas.localRotation; @@ -179,10 +176,10 @@ public void ResetOrientationAndPosition() /// Sent by the PlayerComponent when the pause method is called. /// /// Boolean: Indicates if the player is paused. - void OnPlayerPause(object paused) + void OnPlayerPause(bool paused) { - if (((bool)paused)) - StartCoroutine(RecenterUI()); + if (paused) + RecenterUI(); } } } diff --git a/Assets/Scripts/TES/UI/UIBook.cs b/Assets/Scripts/TES/UI/UIBook.cs index d6428e7..8a4d507 100644 --- a/Assets/Scripts/TES/UI/UIBook.cs +++ b/Assets/Scripts/TES/UI/UIBook.cs @@ -39,10 +39,8 @@ void Start() { var texture = TESUnity.instance.TextureManager.LoadTexture("tx_menubook", true); _background.sprite = GUIUtils.CreateSprite(texture); - transform.localPosition = Vector3.zero; - transform.localRotation = Quaternion.identity; - transform.localScale = Vector3.one; - + + // If the book is already opened, don't change its transform. if (_bookRecord == null) Close(); } @@ -162,6 +160,10 @@ public static UIBook Create(Transform parent) { var uiBookAsset = Resources.Load("UI/Book"); var uiBookGO = (GameObject)GameObject.Instantiate(uiBookAsset, parent); + var uiTransform = uiBookGO.GetComponent(); + uiTransform.localPosition = Vector3.zero; + uiTransform.localRotation = Quaternion.identity; + uiTransform.localScale = Vector3.one; return uiBookGO.GetComponent(); } } diff --git a/Assets/Scripts/TES/UI/UIInteractiveText.cs b/Assets/Scripts/TES/UI/UIInteractiveText.cs index 7403f65..98254f8 100644 --- a/Assets/Scripts/TES/UI/UIInteractiveText.cs +++ b/Assets/Scripts/TES/UI/UIInteractiveText.cs @@ -76,6 +76,9 @@ public void SetParent(Transform transform) { var rectTransform = GetComponent(); rectTransform.SetParent(transform, false); + rectTransform.localPosition = Vector3.zero; + rectTransform.localRotation = Quaternion.identity; + rectTransform.localScale = Vector3.one; } } } \ No newline at end of file diff --git a/Assets/Scripts/TES/UI/UIScroll.cs b/Assets/Scripts/TES/UI/UIScroll.cs index 6fcf18b..2647705 100644 --- a/Assets/Scripts/TES/UI/UIScroll.cs +++ b/Assets/Scripts/TES/UI/UIScroll.cs @@ -23,10 +23,8 @@ void Start() { var texture = TESUnity.instance.TextureManager.LoadTexture("scroll", true); _background.sprite = GUIUtils.CreateSprite(texture); - transform.localPosition = Vector3.zero; - transform.localRotation = Quaternion.identity; - transform.localScale = Vector3.one; + // If the book is already opened, don't change its transform. if (_bookRecord == null) Close(); } @@ -74,6 +72,10 @@ public static UIScroll Create(Transform parent) { var uiScrollAsset = Resources.Load("UI/Scroll"); var uiScrollGO = (GameObject)GameObject.Instantiate(uiScrollAsset, parent); + var uiTransform = uiScrollGO.GetComponent(); + uiTransform.localPosition = Vector3.zero; + uiTransform.localRotation = Quaternion.identity; + uiTransform.localScale = Vector3.one; return uiScrollGO.GetComponent(); } } diff --git a/CHANGES.md b/CHANGES.md index 40ae14e..92be7bc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ #TESUnity Changelog +## Version 0.5 - 10/21/2016 +### Added +- OSVR Support +- Other VR SDKs Support (not yet enabled) +- Enhanced VR support for UI and HUD + ## Version 0.4 - 10/18/2016 ### Added - New flags to enable new features (see readme.md) diff --git a/README-VR.md b/README-VR.md new file mode 100644 index 0000000..34ebe34 --- /dev/null +++ b/README-VR.md @@ -0,0 +1,10 @@ +# TESUnity VR + +TESUnity supports the Oculus Rift, OSVR and the OpenVR API. The world of Morrowind is generated at runtime, so some optimizations can't be done, especially lights and culling optimizations. Because of that, the game can slow down when a new group of cells are loaded. + +## OSVR Users +The [OSVR Unity plugin](https://github.com/OSVR/OSVR-Unity) is not as optimized as other VR vendors. It is recommanded to switch to OpenVR (using SteamVR-OSVR) for best performance. However if you want to use the native OSVR integration, it is recommanded to turn off all effects and use the Unlit shader. We'll work with the OSVR Unity Team to find how to solve this problem. + +If the [SteamVR-OSVR plugin](https://github.com/OSVR/SteamVR-OSVR) is enabled, it will load the OpenVR integration automatically, preventing you to start the game with the native OSVR integration. To solve that, you can +* Disable your SteamVR driver +* Start the game like that `TESUnity.exe -vrmode None`. \ No newline at end of file diff --git a/config.ini.dist b/config.ini.dist index b80ac56..df836a8 100644 --- a/config.ini.dist +++ b/config.ini.dist @@ -2,7 +2,7 @@ [Global] PlayMusic = True -MorrowindPath = C:/Program Files (x86)/Steam/steamapps/common/Morrowind/Data Files +MorrowindPath = C:\Users\demon\Documents\Unity\Demonixis\TESUnity\Data Files [Rendering] RenderPath = 1 @@ -11,18 +11,19 @@ Shader = Bumped [Lighting] AnimateLights = False SunShadows = True -LightShadows = False +LightShadows = True RenderExteriorCellLights = False [Effects] AntiAliasing = False AmbientOcclusion = False -Bloom = False +Bloom = True WaterBackSideTransparent = False [VR] -FollowHeadDirection = False +FollowHeadDirection = True +DirectModePreview = False [Debug] -CreaturesEnabled = False +CreaturesEnabled = True