This commit is contained in:
ousttrue
2021-04-28 17:42:58 +09:00
parent 9dd707134b
commit bb9d9136c3
3 changed files with 52 additions and 11 deletions

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 069e3004cdd162e488caa0fab3983f05
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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));
}