代码语言:javascript
复制
/// <summary>
/// 生成一圈
/// </summary>
/// <param name="forward">物体的前进方向</param>
/// <param name="center">物体位置</param>
/// <param name="radius">半径</param>
/// <param name="cnt">生成几个</param>
/// <returns></returns>
List<Vector3> GetCirclePos(Vector3 forward, Vector3 center, float radius, int cnt)
{
List<Vector3> list = new List<Vector3>();
float angles = 360.0f / cnt;
for (int i = 0; i < cnt; i++)
{
Vector3 pos = Quaternion.Euler(0, angles * i,0) * forward.normalized * radius + center;
list.Add(pos);
}
return list;
}