Line - Verge3D User Manual - Soft8Soft
Description: Learn how to use Line in your interactive 3D apps made with Verge3D

Object3D →

# Line

A continuous line.

This is nearly the same as LineSegments; the only difference is that it is rendered using gl.LINE_STRIP instead of gl.LINES

## Code Example

`const material = new v3d.LineBasicMaterial({ color: 0x0000ff }); const points = []; points.push(new v3d.Vector3(-10, 0, 0)); points.push(new v3d.Vector3(0, 10, 0)); points.push(new v3d.Vector3(10, 0, 0)); const geometry = new v3d.BufferGeometry().setFromPoints(points); const line = new v3d.Line(geometry, material); app.scene.add(line);`

## Constructor

### Line(geometry : BufferGeometry, material : Material)

- geometry — vertices representing the line segment(s). Default is a new BufferGeometry.
- material — material for the line. Default is a new LineBasicMaterial.

## Properties

See the base Object3D class for inherited properties.

### # .geometry : BufferGeometry

Vertices representing the line segment(s).

### # .isLine : Boolean

Read-only flag to check if a given object is of type Line.

### # .material : Material

Material for the line.

### # .morphTargetInfluences : Array

An array of weights typically from 0-1 that specify how much of the morph is applied. Undefined by default, but reset to a blank array by .updateMorphTargets().

### # .morphTargetDictionary : Object

A dictionary of morphTargets based on the morphTarget.name property. Undefined by default, but rebuilt .updateMorphTargets().

## Methods

See the base Object3D class for inherited methods.

### # .clone() → Line

Returns a clone of this Line object and its descendants.

### # .computeLineDistances() → this

Computes an array of distance values. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line.

### # .raycast(raycaster : Raycaster, intersects : Array)

Get intersections between a casted Ray and this Line. Raycaster.intersectObject will call this method.

### # .updateMorphTargets()

Updates the morphTargets to have no influence on the object. Resets the .morphTargetInfluences and .morphTargetDictionary properties.

## Source

For more info on how to obtain the source code of this module see this page.