public static void DrawWireCylinder(Vector3 position, Cylinder cylinder, int segments = 25) { float halfHeight = cylinder.Height / 2.0f; Vector3 centerTop = position.AddToY(halfHeight); Vector3 centerBottom = position.AddToY(-halfHeight); for (int i = 0; i < segments; i++) { float point1Theta = (360.0f / (float)segments) * i; Vector3 point1 = Quaternion.Euler(0, point1Theta, 0) * new Vector3(cylinder.Radius, 0, 0); float point2Theta = (360.0f / (float)segments) * ((i + 1) % segments); Vector3 point2 = Quaternion.Euler(0, point2Theta, 0) * new Vector3(cylinder.Radius, 0, 0); Vector3 topP1 = (point1 + position).AddToY(halfHeight); Vector3 topP2 = (point2 + position).AddToY(halfHeight); Vector3 bottomP1 = (point1 + position).AddToY(-halfHeight); Vector3 bottomP2 = (point2 + position).AddToY(-halfHeight); Gizmos.DrawLine(topP1, topP2); Gizmos.DrawLine(bottomP1, bottomP2); Gizmos.DrawLine(topP1, bottomP1); Gizmos.DrawLine(topP1, centerTop); Gizmos.DrawLine(bottomP1, centerBottom); } }