diff --git a/Assets/VRM10/Editor/Components/Constraint/Coords.cs b/Assets/VRM10/Editor/Components/Constraint/Coords.cs new file mode 100644 index 000000000..d0f307c92 --- /dev/null +++ b/Assets/VRM10/Editor/Components/Constraint/Coords.cs @@ -0,0 +1,32 @@ +using UnityEditor; +using UnityEngine; + +namespace UniVRM10 +{ + public static class Coords + { + public static void Write(Matrix4x4 m, float size) + { + Handles.matrix = m * Matrix4x4.Scale(new Vector3(size, size, size)); + + // Handles.CubeHandleCap(0, Vector3.zero, Quaternion.identity, size, EventType.Repaint); + Handles.color = Color.red; + Handles.DrawLine(Vector3.zero, Vector3.right); + Handles.color = Color.green; + Handles.DrawLine(Vector3.zero, Vector3.up); + Handles.color = Color.blue; + Handles.DrawLine(Vector3.zero, Vector3.forward); + + Handles.color = Color.white; + // xy + Handles.DrawLine(Vector3.right + Vector3.up, Vector3.right); + Handles.DrawLine(Vector3.right + Vector3.up, Vector3.up); + // yz + Handles.DrawLine(Vector3.up + Vector3.forward, Vector3.forward); + Handles.DrawLine(Vector3.up + Vector3.forward, Vector3.up); + // zx + Handles.DrawLine(Vector3.forward + Vector3.right, Vector3.forward); + Handles.DrawLine(Vector3.forward + Vector3.right, Vector3.right); + } + } +} diff --git a/Assets/VRM10/Editor/Components/Constraint/Coords.cs.meta b/Assets/VRM10/Editor/Components/Constraint/Coords.cs.meta new file mode 100644 index 000000000..c41246f85 --- /dev/null +++ b/Assets/VRM10/Editor/Components/Constraint/Coords.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 069e3004cdd162e488caa0fab3983f05 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/VRM10/Editor/Components/Constraint/VRM10RotationConstraintEditor.cs b/Assets/VRM10/Editor/Components/Constraint/VRM10RotationConstraintEditor.cs index e89ff2501..a09155b13 100644 --- a/Assets/VRM10/Editor/Components/Constraint/VRM10RotationConstraintEditor.cs +++ b/Assets/VRM10/Editor/Components/Constraint/VRM10RotationConstraintEditor.cs @@ -37,31 +37,29 @@ namespace UniVRM10 void DrawSrcLocal() { - Handles.color = Color.green; + var s = m_target.transform.lossyScale.x; // init - Handles.matrix = m_target.GetSourceLocalInit(); - Handles.CubeHandleCap(0, Vector3.zero, Quaternion.identity, 0.02f, EventType.Repaint); + Coords.Write(m_target.GetSourceLocalInit(), 0.2f / s); // current Handles.matrix = m_target.Source.localToWorldMatrix; - var size = 0.04f; + Handles.color = Color.yellow; + var size = 0.05f / s; Handles.DrawWireCube(Vector3.zero, new Vector3(size, size, size)); } void DrawDstLocal() { - Handles.color = Color.red; + var s = m_target.transform.lossyScale.x; - var s = m_target.transform.lossyScale; - - // init - Handles.matrix = m_target.GetDstLocalInit(); - Handles.CubeHandleCap(0, Vector3.zero, Quaternion.identity, 0.02f / s.x, EventType.Repaint); + // init + Coords.Write(m_target.GetDstLocalInit(), 0.2f / s); // current Handles.matrix = m_target.transform.localToWorldMatrix; - var size = 0.04f / s.x; + Handles.color = Color.yellow; + var size = 0.05f / s; Handles.DrawWireCube(Vector3.zero, new Vector3(size, size, size)); }