Class VertexPositioning
Contains a set of commonly used functions for modifying mesh positions.
Inherited Members
Namespace: UnityEngine.ProBuilder
Assembly: Unity.ProBuilder.dll
Syntax
public static class VertexPositioning
Methods
SetSharedVertexPosition(ProBuilderMesh, int, Vector3)
Takes a SharedVertex index (index of the triangle in the sharedIndexes array), and changes its vertices to a new position in model space coordinates.
Use sharedIndexes and UnityEditor.ArrayUtility.IndexOf<T>(T[], T) to get a shared (or common) index.
Declaration
public static void SetSharedVertexPosition(this ProBuilderMesh mesh, int sharedVertexHandle, Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the vertices you want to modify. |
int | sharedVertexHandle | The shared (or common) index to set the vertex position of. |
Vector3 | position | The new position in model coordinates. |
TranslateVertices(ProBuilderMesh, IEnumerable<int>, Vector3)
Translates a set of vertices with an offset provided in local (model) coordinates.
This applies the mesh positions to both the ProBuilderMesh and the Mesh.
Declaration
public static void TranslateVertices(this ProBuilderMesh mesh, IEnumerable<int> indexes, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the vertices that you want to translate. |
IEnumerable<int> | indexes | A set of triangles pointing to the vertex positions that you want to translate. |
Vector3 | offset | The offset to apply in local coordinates. |
TranslateVertices(ProBuilderMesh, IEnumerable<Edge>, Vector3)
Translates a set of edges with an offset provided in local (model) coordinates.
This applies the mesh positions to both the ProBuilderMesh and the Mesh.
Declaration
public static void TranslateVertices(this ProBuilderMesh mesh, IEnumerable<Edge> edges, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the edges that you want to translate. |
IEnumerable<Edge> | edges | The set of edges that you want to translate. |
Vector3 | offset | The offset to apply in local coordinates. |
TranslateVertices(ProBuilderMesh, IEnumerable<Face>, Vector3)
Translates a set of faces with an offset provided in local (model) coordinates.
This applies the mesh positions to both the ProBuilderMesh and the Mesh.
Declaration
public static void TranslateVertices(this ProBuilderMesh mesh, IEnumerable<Face> faces, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the faces that you want to translate. |
IEnumerable<Face> | faces | The set of faces that you want to translate. |
Vector3 | offset | The offset to apply in local coordinates. |
TranslateVerticesInWorldSpace(ProBuilderMesh, int[], Vector3)
Translates a set of vertices with a world space offset.
This applies the mesh positions to both the ProBuilderMesh and the Mesh.
Declaration
public static void TranslateVerticesInWorldSpace(this ProBuilderMesh mesh, int[] indexes, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh containing the vertices you want to translate. |
int[] | indexes | An array of triangles pointing to the vertex positions that you want to translate. |
Vector3 | offset | The offset to apply in world coordinates. |
VerticesInWorldSpace(ProBuilderMesh)
Returns a copy of a mesh positions array transformed into world coordinates.
Declaration
public static Vector3[] VerticesInWorldSpace(this ProBuilderMesh mesh)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The source mesh. |
Returns
Type | Description |
---|---|
Vector3[] | An array containing all vertex positions in world space. |