Creating A Line System
Line System
MeshBuilder only. A line system is a set of non-contiguous lines that are independent of each other and may exist in their own space. You must set at least the lines option. On update, you must set the lines and instance options. You can also update the colors option if it was previously set at construction time.
MeshBuilder
Usage :
import { MeshBuilder } from "@babylonjs/core/Meshes/meshBuilder";// creates an instance of a line systemlet lineSystem = MeshBuilder.CreateLineSystem("lineSystem", { lines: myArray }, scene);// updates the existing instance of lineSystem : no need for the parameter scene herelineSystem = MeshBuilder.CreateLineSystem("lineSystem", { lines: myArray, instance: lineSystem });| option | value | default value |
|---|---|---|
| lines | (Vector3[][]) array of lines, each line being an array of successive Vector3 REQUIRED | |
| updatable | (boolean) true if the mesh is updatable | false |
| instance | (LineMesh) an instance of a line system mesh to be updated | null |
| colors | (Color4[]) array of Color4, each point color | null |
| useVertexAlpha | (boolean) false if the alpha blending is not required (faster) | true |
Examples
Example of a line system: Line System Example Update of the line system: Updating Line System Example
Unlike a mesh, lines are colored after creation with a color property rather than a material.
import { Color3 } from "@babylonjs/core/Maths/math.color";linesystem.color = new Color3(1, 0, 0);Colored Line System: Colored Line System Example 1
You can produce multi-colored lines by setting the colors for each point of each line before creation.
Colored Line System Example 2