Class VertexEditing | ProBuilder | 4.3.1
docs.unity3d.com
    Show / Hide Table of Contents

    Class VertexEditing

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

    Inheritance
    Object
    VertexEditing
    Namespace: UnityEngine.ProBuilder.MeshOperations
    Syntax
    public static class VertexEditing

    Methods

    MergeVertices(ProBuilderMesh, Int32[], Boolean)

    Collapses all passed indexes to a single shared index.

    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

    If true, instead of merging all vertices to the average position, the vertices will be collapsed onto the first vertex position.

    Returns
    Type Description
    Int32

    The first available local index created as a result of the merge. -1 if action is unsuccessfull.

    Remarks

    Retains vertex normals.

    SplitVertices(ProBuilderMesh, IEnumerable<Int32>)

    Split vertices from their shared indexes so that each vertex moves independently.

    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 indexes to split.

    See Also
    sharedVertices

    SplitVertices(ProBuilderMesh, Edge)

    Split the vertices referenced by edge from their shared indexes so that each vertex moves independently.

    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).

    Declaration
    public static int[] WeldVertices(this ProBuilderMesh mesh, IEnumerable<int> indexes, float neighborRadius)
    Parameters
    Type Name Description
    ProBuilderMesh mesh

    Target pb_Object.

    IEnumerable<Int32> indexes

    The vertex indexes to be scanned for inclusion. To weld the entire object for example, pass pb.faces.SelectMany(x => x.indexes).

    Single neighborRadius

    The minimum distance from another vertex to be considered within welding distance.

    Returns
    Type Description
    Int32[]

    The indexes of any new vertices created by a weld.

    Back to top
    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