docs.unity3d.com
    Show / Hide Table of Contents

    Class VertexEditing

    Methods for merging and splitting common (or shared) vertices.

    Inheritance
    Object
    VertexEditing
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    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
    sharedVertices

    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
    SplitVertices(ProBuilderMesh, IEnumerable<Int32>)

    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 pb.faces.SelectMany(x => x.indexes).

    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.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023