mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-14 23:10:46 -05:00
Coords
This commit is contained in:
32
Assets/VRM10/Editor/Components/Constraint/Coords.cs
Normal file
32
Assets/VRM10/Editor/Components/Constraint/Coords.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/VRM10/Editor/Components/Constraint/Coords.cs.meta
Normal file
11
Assets/VRM10/Editor/Components/Constraint/Coords.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 069e3004cdd162e488caa0fab3983f05
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user