[page:Object3D] → [page:Mesh] →

[name]

A series of lines drawn between pairs of vertices.

This adds functionality beyond [page:LineSegments], like arbitrary line width and changing width to be in world units. The [page:Line2] extends this object, forming a polyline instead of individual segments.

Import

[name] is an add-on, and therefore must be imported explicitly. See [link:#manual/introduction/Installation Installation / Addons].

import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';

Example

[example:webgl_lines_fat_raycasting WebGL / lines / fat / raycasting ]

Constructor

[name]( [param:LineSegmentsGeometry geometry], [param:LineMaterial material] )

[page:LineSegmentsGeometry geometry] — (optional) Pair(s) of vertices representing each line segment.
[page:Material material] — (optional) Material for the line. Default is a [page:LineMaterial] with random color.

Properties

See the base [page:Mesh] class for common properties.

[property:Boolean isLineSegments2]

Read-only flag to check if a given object is of type [name].

Methods

See the base [page:Mesh] class for common methods.

[method:undefined onBeforeRender]( [param:WebGLRenderer renderer] )

Called by the framework to update the material's resolution property, needed for screen-scaled widths.

If your object is not visible to a camera (e.g. by [page:Object3D.layers layers] or [page:Object3D.visible visible],) you must call this manually whenever the viewport changes.

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/lines/LineSegments2.js examples/jsm/lines/LineSegments2.js]