book_4_sparkGenerated
code_blocksInput

Description

The LineStrip field of the MeshPrimitiveType enumeration represents a series of connected lines. Each line segment in a line strip shares a vertex with the previous segment, forming a continuous path. This is useful for rendering connected lines, such as polylines or paths, where each vertex after the first defines a new line segment.

Usage

Use MeshPrimitiveType.LineStrip when you want to render a series of connected lines. This is particularly useful in scenarios where you need to draw paths or outlines that are not closed shapes. Each vertex in the line strip, after the first, will connect to the previous vertex to form a line segment.

Example

// Example of using MeshPrimitiveType.LineStrip
Mesh mesh = new Mesh();
mesh.SetPrimitiveType(MeshPrimitiveType.LineStrip);

// Define vertices for the line strip
Vector3[] vertices = new Vector3[]
{
    new Vector3(0, 0, 0),
    new Vector3(1, 0, 0),
    new Vector3(1, 1, 0),
    new Vector3(0, 1, 0)
};

// Set vertices to the mesh
mesh.SetVertices(vertices);

// The mesh will render as a line strip connecting the vertices in order.