1
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Splines;
|
||||
namespace BITKit
|
||||
{
|
||||
public class UnityWireSplineCreator : MonoBehaviour,IAction
|
||||
{
|
||||
public Mesh mesh;
|
||||
public SplineContainer container;
|
||||
public SplineExtrude extrude;
|
||||
// ReSharper disable Unity.PerformanceAnalysis
|
||||
[ContextMenu(nameof(Excute))]
|
||||
public void Excute()
|
||||
{
|
||||
UnityEngine.Splines.Spline spline = new();
|
||||
var count = 0;
|
||||
// foreach (var vertexes in MathE.Combinations(mesh.vertices))
|
||||
// {
|
||||
// foreach (var vertex in vertexes)
|
||||
// {
|
||||
// spline.Add(new BezierKnot()
|
||||
// {
|
||||
// Position = vertex
|
||||
// });
|
||||
// count++;
|
||||
// }
|
||||
// }
|
||||
foreach (var vertex in mesh.vertices)
|
||||
{
|
||||
spline.Add(new (vertex));
|
||||
count++;
|
||||
}
|
||||
container.Spline = spline;
|
||||
extrude.Rebuild();
|
||||
Debug.Log($"已创建{count}个顶点");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user