修改水
This commit is contained in:
@@ -65,19 +65,17 @@ namespace Obi
|
||||
private static void DrawGizmos(ObiRopeCursor cursor, GizmoType gizmoType)
|
||||
{
|
||||
var rope = cursor.GetComponent<ObiRope>();
|
||||
if (rope.isLoaded)
|
||||
if (rope.solver != null)
|
||||
{
|
||||
Handles.matrix = rope.solver.transform.localToWorldMatrix;
|
||||
Handles.color = new Color(1, 0.5f, 0.2f, 1);
|
||||
Gizmos.color = new Color(1, 0.5f, 0, 0.75f);
|
||||
|
||||
// draw source particle:
|
||||
int sourceIndex = cursor.sourceParticleIndex;
|
||||
|
||||
if (sourceIndex >= 0 && rope.IsParticleActive(rope.solver.particleToActor[sourceIndex].indexInActor))
|
||||
{
|
||||
Vector3 pos = rope.solver.positions[sourceIndex];
|
||||
float size = HandleUtility.GetHandleSize(pos) * 0.15f;
|
||||
Handles.SphereHandleCap(0, pos, Quaternion.identity, size, EventType.Repaint);
|
||||
Vector3 pos = rope.GetParticlePosition(sourceIndex);
|
||||
Gizmos.DrawWireSphere(pos, HandleUtility.GetHandleSize(pos) * 0.4f);
|
||||
}
|
||||
|
||||
// draw cursor:
|
||||
@@ -85,12 +83,13 @@ namespace Obi
|
||||
|
||||
if (element != null && element.particle1 != element.particle2)
|
||||
{
|
||||
Vector3 pos = rope.solver.positions[cursor.direction ? element.particle1 : element.particle2];
|
||||
Vector3 pos2 = rope.solver.positions[cursor.direction ? element.particle2 : element.particle1];
|
||||
Vector3 pos = rope.GetParticlePosition(cursor.direction ? element.particle1 : element.particle2);
|
||||
Vector3 pos2 = rope.GetParticlePosition(cursor.direction ? element.particle2 : element.particle1);
|
||||
Vector3 direction = pos2 - pos;
|
||||
|
||||
float size = HandleUtility.GetHandleSize(pos) * 0.25f;
|
||||
Handles.ConeHandleCap(0, pos + Vector3.Normalize(direction)*size*0.5f, Quaternion.LookRotation(direction), size, EventType.Repaint);
|
||||
float size = HandleUtility.GetHandleSize(pos) * 0.4f;
|
||||
Gizmos.matrix = Matrix4x4.TRS(pos, Quaternion.LookRotation(direction), Vector3.one * size);
|
||||
DrawArrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user