# Path3D

Represents a 3D path made up of multiple 3D points

• Path3D

## Constructors

### constructor

Find examples in Playground
• new Path3D(path, normal, raw) Creates a Path3D. A Path3D is a logical math object, so not a mesh. please read the description in the tutorial : https://doc.babylonjs.com/how_to/how_to_use_path3d

#### Parameters

• ##### path: Vector3[]

an array of Vector3, the curve axis of the Path3D

• ##### Optional firstNormal: Nullable<Vector3>

(options) Vector3, the first wanted normal to the curve. Ex (0, 1, 0) for a vertical normal.

• ##### Optional raw: boolean

(optional, default false) : boolean, if true the returned Path3D isn't normalized. Useful to depict path acceleration or speed.

• ##### Optional alignTangentsWithPath: boolean

(optional, default false) : boolean, if true the tangents will be aligned with the path.

## Properties

### path

Find examples in Playground
path: Vector3[]

an array of Vector3, the curve axis of the Path3D

## Methods

### getBinormalAt

Find examples in Playground
• getBinormalAt(position: number, interpolated?: boolean): Vector3
• Returns the binormal vector of an interpolated Path3D curve point at the specified position along this path.

#### Parameters

• ##### position: number

the position of the point along this path, from 0.0 to 1.0

• ##### Optional interpolated: boolean

(optional, default false) : boolean, if true returns an interpolated binormal instead of the binormal of the previous path point.

#### Returns Vector3

a binormal vector corresponding to the interpolated Path3D curve point, if not interpolated, the binormal is taken from the precomputed binormals array.

### getBinormals

Find examples in Playground
• Returns an array populated with binormal vectors on each Path3D curve point.

#### Returns Vector3[]

an array populated with binormal vectors on each Path3D curve point.

### getClosestPositionTo

Find examples in Playground
• getClosestPositionTo(target: Vector3): number
• Returns the position of the closest virtual point on this path to an arbitrary Vector3, from 0.0 to 1.0

#### Parameters

• ##### target: Vector3

the vector of which to get the closest position to

#### Returns number

the position of the closest virtual point on this path to the target vector

### getCurve

Find examples in Playground
• Returns the Path3D array of successive Vector3 designing its curve.

#### Returns Vector3[]

the Path3D array of successive Vector3 designing its curve.

### getDistanceAt

Find examples in Playground
• getDistanceAt(position: number): number
• Returns the distance (float) of an interpolated Path3D curve point at the specified position along this path.

#### Parameters

• ##### position: number

the position of the point along this path, from 0.0 to 1.0

#### Returns number

the distance of the interpolated Path3D curve point at the specified position along this path.

### getDistances

Find examples in Playground
• getDistances(): number[]
• Returns an array populated with distances (float) of the i-th point from the first curve point.

#### Returns number[]

an array populated with distances (float) of the i-th point from the first curve point.

### getNormalAt

Find examples in Playground
• getNormalAt(position: number, interpolated?: boolean): Vector3
• Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.

#### Parameters

• ##### position: number

the position of the point along this path, from 0.0 to 1.0

• ##### Optional interpolated: boolean

(optional, default false) : boolean, if true returns an interpolated normal instead of the normal of the previous path point.

#### Returns Vector3

a normal vector corresponding to the interpolated Path3D curve point, if not interpolated, the normal is taken from the precomputed normals array.

### getNormals

Find examples in Playground
• Returns an array populated with normal vectors on each Path3D curve point.

#### Returns Vector3[]

an array populated with normal vectors on each Path3D curve point.

### getPointAt

Find examples in Playground
• getPointAt(position: number): Vector3
• Returns an interpolated point along this path

#### Parameters

• ##### position: number

the position of the point along this path, from 0.0 to 1.0

#### Returns Vector3

a new Vector3 as the point

### getPoints

Find examples in Playground
• Returns the Path3D array of successive Vector3 designing its curve.

#### Returns Vector3[]

the Path3D array of successive Vector3 designing its curve.

### getPreviousPointIndexAt

Find examples in Playground
• getPreviousPointIndexAt(position: number): number
• Returns the array index of the previous point of an interpolated point along this path

#### Parameters

• ##### position: number

the position of the point to interpolate along this path, from 0.0 to 1.0

#### Returns number

the array index

### getSubPositionAt

Find examples in Playground
• getSubPositionAt(position: number): number
• Returns the position of an interpolated point relative to the two path points it lies between, from 0.0 (point A) to 1.0 (point B)

#### Parameters

• ##### position: number

the position of the point to interpolate along this path, from 0.0 to 1.0

#### Returns number

the sub position

### getTangentAt

Find examples in Playground
• getTangentAt(position: number, interpolated?: boolean): Vector3
• Returns the tangent vector of an interpolated Path3D curve point at the specified position along this path.

#### Parameters

• ##### position: number

the position of the point along this path, from 0.0 to 1.0

• ##### Optional interpolated: boolean

(optional, default false) : boolean, if true returns an interpolated tangent instead of the tangent of the previous path point.

#### Returns Vector3

a tangent vector corresponding to the interpolated Path3D curve point, if not interpolated, the tangent is taken from the precomputed tangents array.

### getTangents

Find examples in Playground
• Returns an array populated with tangent vectors on each Path3D curve point.

#### Returns Vector3[]

an array populated with tangent vectors on each Path3D curve point.

### length

Find examples in Playground
• length(): number
• #### Returns number

the computed length (float) of the path.

### slice

Find examples in Playground
• slice(start?: number, end?: number): Path3D
• Returns a sub path (slice) of this path

#### Parameters

• ##### Optional start: number

the position of the fist path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values

• ##### Optional end: number

the position of the last path point, from 0.0 to 1.0, or a negative value, which will get wrapped around from the end of the path to 0.0 to 1.0 values

#### Returns Path3D

a sub path (slice) of this path

### update

Find examples in Playground
• Forces the Path3D tangent, normal, binormal and distance recomputation.

#### Parameters

• ##### path: Vector3[]

path which all values are copied into the curves points

• ##### Optional firstNormal: Nullable<Vector3>

which should be projected onto the curve

• ##### Optional alignTangentsWithPath: boolean

(optional, default false) : boolean, if true the tangents will be aligned with the path

#### Returns Path3D

the same object updated.

Generated using TypeDoc