Class VertexPositioning
A set of commonly used functions for modifying mesh positions.
Namespace: UnityEngine.ProBuilder
Syntax
public static class VertexPositioning
Methods
SetSharedVertexPosition(ProBuilderMesh, Int32, Vector3)
Given a shared vertex index (index of the triangle in the sharedIndexes array), move all vertices to new position.
Position is in model space coordinates.
Use @"UnityEngine.ProBuilder.ProBuilderMesh.sharedIndexes" and IntArrayUtility.IndexOf 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 target mesh. |
Int32 | sharedVertexHandle | The shared (or common) index to set the vertex position of. |
Vector3 | position | The new position in model coordinates. |
TranslateVertices(ProBuilderMesh, IEnumerable<Int32>, Vector3)
Translate a set of vertices with an offset provided in local (model) coordinates.
Unlike most other mesh operations, this function applies the mesh positions to both ProBuilderMesh and the UnityEngine.Mesh.
Declaration
public static void TranslateVertices(this ProBuilderMesh mesh, IEnumerable<int> indexes, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to be affected. |
IEnumerable<Int32> | indexes | A set of triangles pointing to the vertex positions that are to be affected. |
Vector3 | offset |
TranslateVertices(ProBuilderMesh, IEnumerable<Edge>, Vector3)
Translate a set of vertices with an offset provided in local (model) coordinates.
Unlike most other mesh operations, this function applies the mesh positions to both ProBuilderMesh and the UnityEngine.Mesh.
Declaration
public static void TranslateVertices(this ProBuilderMesh mesh, IEnumerable<Edge> edges, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to be affected. |
IEnumerable<Edge> | edges | A set of edges that are to be affected. |
Vector3 | offset |
TranslateVertices(ProBuilderMesh, IEnumerable<Face>, Vector3)
Translate a set of vertices with an offset provided in local (model) coordinates.
Unlike most other mesh operations, this function applies the mesh positions to both ProBuilderMesh and the UnityEngine.Mesh.
Declaration
public static void TranslateVertices(this ProBuilderMesh mesh, IEnumerable<Face> faces, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to be affected. |
IEnumerable<Face> | faces | A set of faces that are to be affected. |
Vector3 | offset |
TranslateVerticesInWorldSpace(ProBuilderMesh, Int32[], Vector3)
Translate a set of vertices with a world space offset.
Unlike most other mesh operations, this function applies the mesh positions to both ProBuilderMesh and the UnityEngine.Mesh.
Declaration
public static void TranslateVerticesInWorldSpace(this ProBuilderMesh mesh, int[] indexes, Vector3 offset)
Parameters
Type | Name | Description |
---|---|---|
ProBuilderMesh | mesh | The mesh to be affected. |
Int32[] | indexes | A set of triangles pointing to the vertex positions that are to be affected. |
Vector3 | offset | The offset to apply in world coordinates. |
VerticesInWorldSpace(ProBuilderMesh)
Get 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. |