docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class VertexEditing

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

    Inheritance
    object
    VertexEditing
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.ProBuilder.MeshOperations
    Assembly: Unity.ProBuilder.dll
    Syntax
    public static class VertexEditing

    Methods

    MergeVertices(ProBuilderMesh, int[], bool)

    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.

    int[] indexes

    The indexes to merge to a single shared vertex.

    bool collapseToFirst

    True to collapse the vertices onto the first vertex position; false to merge all vertices to the average position.

    Returns
    Type Description
    int

    The first available local index created as a result of the merge, or -1 if action failed.

    Remarks

    Retains vertex normals.

    SplitVertices(ProBuilderMesh, IEnumerable<int>)

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

    WeldVertices(ProBuilderMesh, IEnumerable<int>, float)

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

    float neighborRadius

    The minimum distance between vertices to consider them for welding.

    Returns
    Type Description
    int[]

    The indices of any new vertices created by a weld.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)