Creating A Line System

Line System

MeshBuilder only. A system 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 previously set at construction time.

MeshBuilder

Usage :

// creates an instance of a line system
let lineSystem = BABYLON.MeshBuilder.CreateLineSystem("lineSystem", {lines: myArray}, scene);
// updates the existing instance of lineSystem : no need for the parameter scene here
lineSystem = BABYLON.MeshBuilder.CreateLineSystem("lineSystem", {lines: myArray, instance: lineSystem});
optionvaluedefault value
option
lines
value
(Vector3[][]) array of lines, each line being an array of successive Vector3 REQUIRED
default value
 
option
updatable
value
(boolean) true if the mesh is updatable
default value
false
option
instance
value
(LineMesh) an instance of a line system mesh to be updated
default value
null
option
colors
value
(Color4[]) array of Color4, each point color
default value
null
option
useVertexAlpha
value
(boolean) false if the alpha blending is not required (faster)
default value
true

Examples

Example of a Linesystem: Line System Example Update of the Linesystem: Updating Line System Example

Unlike a mesh Lines are colored after creation with a color property rather than a material.

linesystem.color = new BABYLON.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