public void OnSceneGUI() { if (Event.current.type == EventType.Repaint) { ObiRope rope = cursor.GetComponent <ObiRope>(); ObiDistanceConstraintBatch distanceBatch = rope.DistanceConstraints.GetFirstBatch(); Handles.color = Color.yellow; int constraint = rope.GetConstraintIndexAtNormalizedCoordinate(cursor.normalizedCoord); Vector3 pos1 = rope.GetParticlePosition(distanceBatch.springIndices[constraint * 2]); Vector3 pos2 = rope.GetParticlePosition(distanceBatch.springIndices[constraint * 2 + 1]); if (cursor.direction) { Handles.DrawWireDisc(pos1, pos2 - pos1, rope.thickness * 2); Vector3 direction = pos2 - pos1; if (direction != Vector3.zero) { Handles.ArrowHandleCap(0, pos1, Quaternion.LookRotation(direction), 0.2f, EventType.Repaint); } } else { Handles.DrawWireDisc(pos2, pos1 - pos2, rope.thickness * 2); Vector3 direction = pos1 - pos2; if (direction != Vector3.zero) { Handles.ArrowHandleCap(0, pos2, Quaternion.LookRotation(direction), 0.2f, EventType.Repaint); } } } }
public override void UpdateParticleEditorInformation() { for (int i = 0; i < rope.positions.Length; i++) { wsPositions[i] = rope.GetParticlePosition(i); facingCamera[i] = true; } }