File: LineSegments2.md | Updated: 11/15/2025
A series of lines drawn between pairs of vertices.
This adds functionality beyond LineSegments, like arbitrary line width and changing width to be in world units. Line2 extends this object, forming a polyline instead of individual segments.
This module can only be used with WebGLRenderer. When using WebGPURenderer, import the class from lines/webgpu/LineSegments2.js.
const geometry = new LineSegmentsGeometry();
geometry.setPositions( positions );
geometry.setColors( colors );
const material = new LineMaterial( { linewidth: 5, vertexColors: true } };
const lineSegments = new LineSegments2( geometry, material );
scene.add( lineSegments );
LineSegments2 is an addon, and must be imported explicitly, see Installation#Addons.
import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';
Constructs a new wide line.
geometry | The line geometry.
---|---
material | The line material.
This flag can be used for type testing.
Default is true.
Computes an array of distance values which are necessary for rendering dashed lines. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line.
Returns: A reference to this instance.
Computes intersection points between a casted ray and this instance.
raycaster | The raycaster.
---|---
intersects | The target array that holds the intersection points.
Overrides: Mesh#raycast