mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-24 23:18:04 -05:00
spring と 関連のある collider も描画する
This commit is contained in:
parent
8c09ff60df
commit
a30dfd363b
|
|
@ -128,8 +128,9 @@ namespace UniVRM10
|
|||
EditorGUILayout.LabelField($"ColliderGroups[{j}]({group.Name})");
|
||||
for (int k = 0; k < group.Colliders.Count; ++k)
|
||||
{
|
||||
var collider = group.Colliders[k];
|
||||
var label = $"Colliders[{k}]";
|
||||
EditorGUILayout.ObjectField(label, group.Colliders[k], typeof(VRM10SpringBoneCollider), true, null);
|
||||
EditorGUILayout.ObjectField(label, collider, typeof(VRM10SpringBoneCollider), true, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ namespace UniVRM10
|
|||
{
|
||||
var tail = end - start;
|
||||
var distance = (end - start).magnitude;
|
||||
var backup = Gizmos.matrix;
|
||||
Gizmos.matrix = Matrix4x4.TRS(start, Quaternion.FromToRotation(Vector3.forward, tail), Vector3.one);
|
||||
Gizmos.DrawWireSphere(Vector3.zero, radius);
|
||||
Gizmos.DrawWireSphere(Vector3.forward * distance, radius);
|
||||
|
|
@ -82,12 +83,13 @@ namespace UniVRM10
|
|||
{
|
||||
Gizmos.DrawLine(offsets[i] * radius, capsuleEnd + offsets[i] * radius);
|
||||
}
|
||||
Gizmos.matrix = Matrix4x4.identity;
|
||||
Gizmos.matrix = backup;
|
||||
}
|
||||
|
||||
public static void DrawPlane(in Matrix4x4 m, in Vector3 offset, in Vector3 _n, float radius)
|
||||
{
|
||||
var n = _n.normalized;
|
||||
var backup = Gizmos.matrix;
|
||||
Gizmos.matrix = m;
|
||||
Gizmos.DrawLine(offset, offset + n * radius);
|
||||
|
||||
|
|
@ -147,6 +149,7 @@ namespace UniVRM10
|
|||
Gizmos.DrawLine(o - zr, o + zr);
|
||||
}
|
||||
}
|
||||
Gizmos.matrix = backup;
|
||||
}
|
||||
|
||||
public string GetIdentificationName()
|
||||
|
|
|
|||
|
|
@ -80,23 +80,32 @@ namespace UniVRM10
|
|||
}
|
||||
m_drawRequest = 0;
|
||||
|
||||
VRM10SpringBoneJoint lastJoint = null;
|
||||
foreach (var joint in Joints)
|
||||
var backup = Gizmos.matrix;
|
||||
Gizmos.matrix = Matrix4x4.identity;
|
||||
VRM10SpringBoneJoint lastJoint = Joints[0];
|
||||
{
|
||||
const float f = 0.005f;
|
||||
Gizmos.DrawCube(lastJoint.transform.position, new Vector3(f, f, f));
|
||||
}
|
||||
for (int i = 1; i < Joints.Count; ++i)
|
||||
{
|
||||
var joint = Joints[i];
|
||||
Gizmos.color = (lastJoint == VRM10SpringBoneJoint.s_activeForGizmoDraw) ? Color.green : Color.yellow;
|
||||
Gizmos.matrix = joint.transform.localToWorldMatrix;
|
||||
if (lastJoint == null)
|
||||
{
|
||||
const float f = 0.005f;
|
||||
Gizmos.DrawCube(Vector3.zero, new Vector3(f, f, f));
|
||||
}
|
||||
else
|
||||
{
|
||||
Gizmos.DrawLine(Vector3.zero, -joint.transform.localPosition);
|
||||
Gizmos.DrawWireSphere(Vector3.zero, lastJoint.m_jointRadius);
|
||||
Gizmos.DrawLine(lastJoint.transform.position, joint.transform.position);
|
||||
Gizmos.DrawWireSphere(joint.transform.position, lastJoint.m_jointRadius);
|
||||
}
|
||||
lastJoint = joint;
|
||||
}
|
||||
|
||||
foreach (var group in ColliderGroups)
|
||||
{
|
||||
foreach (var collider in group.Colliders)
|
||||
{
|
||||
collider.OnDrawGizmosSelected();
|
||||
}
|
||||
}
|
||||
Gizmos.matrix = backup;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user