public void OnDrawGizmos() { Shape3 clipper = new Shape3(); Quaternion q = Quaternion.Euler(0, 0, 0); clipper.AddVertex(q * new Vector3(-20, 0, 10)); clipper.AddVertex(q * new Vector3(20, 0, 10)); clipper.AddVertex(q * new Vector3(20, 0, 50)); clipper.AddVertex(q * new Vector3(-20, 0, 50)); if (reverseClipper) clipper.Reverse(); clipper.Offset(offsetClipper); Gizmos.color = Color.red; Gizmos.DrawSphere(clipper[0], 1); foreach (Edge3Abs e in clipper) { Gizmos.DrawLine(e.a, e.b); } q = Quaternion.Euler(0, rotation, 0); Shape3 clippee = new Shape3(); clippee.AddVertex(q * new Vector3(0, 0, -20) + position); clippee.AddVertex(q * new Vector3(-20, 0, 30) + position); clippee.AddVertex(q * new Vector3(20, 0, 30) + position); if (reverseClippee) clippee.Reverse(); clippee.Offset(offsetClippee); clippee.RotatedScale(position, rotation, Vector3.one * scale); Gizmos.color = Color.white; foreach (Edge3Abs e in clippee) { Gizmos.DrawLine(e.a, e.b); } Shape3 clipped = clippee.ClipOut(clipper); Gizmos.color = Color.green; foreach (Edge3Abs e in clipped) { Gizmos.DrawLine(e.a, e.b); } }