diff --git a/Assets/Scenes/Version2.unity b/Assets/Scenes/Version2.unity index fa698ab..16f521e 100644 --- a/Assets/Scenes/Version2.unity +++ b/Assets/Scenes/Version2.unity @@ -39556,9 +39556,9 @@ RectTransform: m_Father: {fileID: 6878219667498913896} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 106.5, y: -286} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 180, y: 20} m_Pivot: {x: 0.5, y: 1} --- !u!114 &6878219665895574065 @@ -40064,9 +40064,9 @@ RectTransform: m_Father: {fileID: 6878219667498913896} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 106.5, y: -57.2} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 180, y: 20} m_Pivot: {x: 0.5, y: 1} --- !u!114 &6878219666109573094 @@ -41839,7 +41839,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: FOV (default 60) + m_Text: FOV (default 40) --- !u!222 &6878219666679407127 CanvasRenderer: m_ObjectHideFlags: 0 @@ -42421,9 +42421,9 @@ RectTransform: m_Father: {fileID: 6878219667498913896} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 106.5, y: -171.6} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 180, y: 20} m_Pivot: {x: 0.5, y: 1} --- !u!114 &6878219666841734894 @@ -43252,9 +43252,9 @@ RectTransform: m_Father: {fileID: 6878219667498913896} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 106.5, y: -228.8} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 180, y: 20} m_Pivot: {x: 0.5, y: 1} --- !u!114 &6878219667203546886 @@ -44964,9 +44964,9 @@ RectTransform: m_Father: {fileID: 6878219667498913896} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 106.5, y: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 180, y: 20} m_Pivot: {x: 0.5, y: 1} --- !u!114 &6878219667749320559 @@ -45184,9 +45184,9 @@ RectTransform: m_Father: {fileID: 6878219667498913896} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 106.5, y: -114.4} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 180, y: 20} m_Pivot: {x: 0.5, y: 1} --- !u!1 &6878219667784581358 diff --git a/Assets/Scripts/CameraOrbit.cs b/Assets/Scripts/CameraOrbit.cs index 48dc107..73ee9ca 100644 --- a/Assets/Scripts/CameraOrbit.cs +++ b/Assets/Scripts/CameraOrbit.cs @@ -8,6 +8,7 @@ using UnityEngine.Rendering.PostProcessing; public class CameraOrbit : MonoBehaviour { + public static CameraOrbit instance; public int CameraMode = 0; public int AAMode = 0; @@ -52,6 +53,7 @@ public class CameraOrbit : MonoBehaviour eventSystem = EventSystem.current; lookRotation = transform.localRotation; + instance = this; } void Update() diff --git a/Assets/Scripts/UmaViewerGlobalShader.cs b/Assets/Scripts/UmaViewerGlobalShader.cs index b358e25..99c595a 100644 --- a/Assets/Scripts/UmaViewerGlobalShader.cs +++ b/Assets/Scripts/UmaViewerGlobalShader.cs @@ -126,8 +126,13 @@ public class UmaViewerGlobalShader : MonoBehaviour private void FixedUpdate() { //Used to calculate the correct outline - _GlobalCameraFov = Camera.main.fieldOfView; - Shader.SetGlobalFloat("_GlobalCameraFov", _GlobalCameraFov); + if (UmaViewerBuilder.Instance.CurrentUMAContainer) + { + var camera = Camera.main; + var distance = Vector3.Distance(camera.transform.position, UmaViewerBuilder.Instance.CurrentUMAContainer.transform.position); + var outlineWidth = 40.0f * distance * Mathf.Tan(camera.fieldOfView * 0.5f * Mathf.Deg2Rad); + Shader.SetGlobalFloat("_GlobalCameraFov", outlineWidth); + } }