WXMC/.svn/pristine/6e/6e7b3c356f9494d2757a33ca64e1b124adf3d8d9.svn-base
2024-12-04 16:18:46 +08:00

21 lines
601 B
Plaintext

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public static class GizmosUtils
{
public static int segments = 50;
public static void DrawCircle(Vector3 position, float radius)
{
Vector3 lastPoint = position + new Vector3(radius, 0, 0);
for (int i = 1; i <= segments; i++)
{
float angle = i * 2 * Mathf.PI / segments;
Vector3 newPoint = position + new Vector3(Mathf.Cos(angle), Mathf.Sin(angle)) * radius;
Gizmos.DrawLine(lastPoint, newPoint);
lastPoint = newPoint;
}
}
}