private void UpdateMeshVerts(Vector3[] points) { if (Target == null) { throw new System.NullReferenceException("Line needs a target camera to calulate its facing."); } MeshData meshData = new MeshData(); LineGenerators.GenerateMeshDataFromPoints(ref meshData, points, Target.position, transform.position, Width, Continuous, false); _MeshFilter.mesh.vertices = meshData.Verts; }
public static Vector3[] QuadTubeVerts(Vector3[] centerSpine, float[] widths, int vertexCountPerRing, Vector3 worldOffset) { if (centerSpine.Length != widths.Length) { throw new System.ArgumentException("center spine and widths arrays must be the same length."); } Vector3[] quadTubeVerts = new Vector3[vertexCountPerRing * centerSpine.Length]; Vector3 direction = Vector3.zero; //Calculate vertexes for for (int i = 0; i < centerSpine.Length; i++) { if (i < centerSpine.Length - 1) { direction = (centerSpine[i] - centerSpine[i + 1]).normalized; } Vector3[] newVerts = LineGenerators.VertexRing(centerSpine[i], widths[i], direction, vertexCountPerRing, worldOffset); System.Array.Copy(newVerts, 0, quadTubeVerts, vertexCountPerRing * i, newVerts.Length); } return(quadTubeVerts); }