From 2664a773e08ef3d0b0723110a11703a07883cc54 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 16 Jun 2021 15:38:10 +0900 Subject: [PATCH] DrawLookAtGizmo --- .../Editor/Components/LookAt/LookAtEditor.cs | 9 +++---- .../Runtime/Components/VRM10Controller.cs | 3 +++ .../VRM10Object/VRM10ControllerLookAt.cs | 26 ++++++++----------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Assets/VRM10/Editor/Components/LookAt/LookAtEditor.cs b/Assets/VRM10/Editor/Components/LookAt/LookAtEditor.cs index 9ca76df47..5a8488792 100644 --- a/Assets/VRM10/Editor/Components/LookAt/LookAtEditor.cs +++ b/Assets/VRM10/Editor/Components/LookAt/LookAtEditor.cs @@ -16,6 +16,10 @@ namespace UniVRM10 { return; } + if (!target.DrawLookAtGizmo) + { + return; + } if (head == null) { return; @@ -36,11 +40,6 @@ namespace UniVRM10 static void OnSceneGUIOffset(VRM10Controller m_target, Transform head) { - if (!m_target.Vrm.LookAt.DrawGizmo) - { - return; - } - EditorGUI.BeginChangeCheck(); var worldOffset = head.localToWorldMatrix.MultiplyPoint(m_target.Vrm.LookAt.OffsetFromHead); diff --git a/Assets/VRM10/Runtime/Components/VRM10Controller.cs b/Assets/VRM10/Runtime/Components/VRM10Controller.cs index 680dea9f3..efa58f163 100644 --- a/Assets/VRM10/Runtime/Components/VRM10Controller.cs +++ b/Assets/VRM10/Runtime/Components/VRM10Controller.cs @@ -28,6 +28,9 @@ namespace UniVRM10 [SerializeField] public Transform SpringBoneCenter; + [SerializeField, Header("LookAt")] + public bool DrawLookAtGizmo = true; + /// /// LookAtTargetTypes.CalcYawPitchToGaze時の注視点 /// diff --git a/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ControllerLookAt.cs b/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ControllerLookAt.cs index f00bf3411..ec904f2a1 100644 --- a/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ControllerLookAt.cs +++ b/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ControllerLookAt.cs @@ -16,9 +16,6 @@ namespace UniVRM10 SetYawPitch, } - [SerializeField] - public bool DrawGizmo = true; - [SerializeField] public Vector3 OffsetFromHead = new Vector3(0, 0.06f, 0); @@ -164,17 +161,17 @@ namespace UniVRM10 const float LOOKAT_GIZMO_SIZE = 0.5f; - private void OnDrawGizmos() - { - if (DrawGizmo) - { - if (m_leftEye != null & m_rightEye != null) - { - DrawMatrix(m_leftEye.localToWorldMatrix, LOOKAT_GIZMO_SIZE); - DrawMatrix(m_rightEye.localToWorldMatrix, LOOKAT_GIZMO_SIZE); - } - } - } + // private void OnDrawGizmos() + // { + // if (DrawGizmo) + // { + // if (m_leftEye != null & m_rightEye != null) + // { + // DrawMatrix(m_leftEye.localToWorldMatrix, LOOKAT_GIZMO_SIZE); + // DrawMatrix(m_rightEye.localToWorldMatrix, LOOKAT_GIZMO_SIZE); + // } + // } + // } #endregion const float RADIUS = 0.5f; @@ -182,7 +179,6 @@ namespace UniVRM10 public void OnSceneGUILookAt(Transform head, LookAtTargetTypes lookAtTargetType, Transform gaze) { if (head == null) return; - if (!DrawGizmo) return; if (gaze != null) {