Class VertexEditing
Methods for merging and splitting common (or shared) vertices.
Inherited Members
Namespace: UnityEngine.ProBuilder.MeshOperations
Syntax
public static class VertexEditing
Methods
MergeVertices(ProBuilderMesh, Int32[], Boolean)
Collapses all specified indices to a single shared index.
This is equivalent to the Collapse Vertices action.
Declaration
public static int MergeVertices(this ProBuilderMesh mesh, int[] indexes, bool collapseToFirst = false)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | Target mesh. |
Int32[] | indexes | The indexes to merge to a single shared vertex. |
Boolean | collapseToFirst | True to collapse the vertices onto the first vertex position; false to merge all vertices to the average position. |
Returns
Type | Description |
---|---|
Int32 | The first available local index created as a result of the merge, or -1 if action failed. |
Remarks
Retains vertex normals.
SplitVertices(ProBuilderMesh, IEnumerable<Int32>)
Splits vertices from their shared indices so that each vertex moves independently.
This corresponds to the Split Vertices action.
Declaration
public static void SplitVertices(this ProBuilderMesh mesh, IEnumerable<int> vertices)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
IEnumerable<Int32> | vertices | A list of vertex indices to split. |
See Also
SplitVertices(ProBuilderMesh, Edge)
Splits the vertices referenced by edge from their shared indices so that each vertex moves independently.
This corresponds to the Split Vertices action.
Declaration
public static void SplitVertices(this ProBuilderMesh mesh, Edge edge)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Edge | edge | The edge to query for vertex indexes. |
Remarks
This is equivalent to calling SplitVertices(mesh, new int[] { edge.x, edge.y });
.
See Also
WeldVertices(ProBuilderMesh, IEnumerable<Int32>, Single)
Similar to Merge vertices, expect that this method only collapses vertices within a specified distance
of one another (typically Mathf.Epsilon
is used).
This is equivalent to the Weld Vertices action.
Declaration
public static int[] WeldVertices(this ProBuilderMesh mesh, IEnumerable<int> indexes, float neighborRadius)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
IEnumerable<Int32> | indexes | The vertex indices to consider. For example, to weld the entire object, set this value to the return value from |
Single | neighborRadius | The minimum distance between vertices to consider them for welding. |
Returns
Type | Description |
---|---|
Int32[] | The indices of any new vertices created by a weld. |