Options
All
• Public
• Public/Protected
• All

# Class Path3D

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

see

https://doc.babylonjs.com/features/featuresDeepDive/mesh/path3D

• Path3D

## Constructors

• 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/features/featuresDeepDive/mesh/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: Vector3[]

an array of Vector3, the curve axis of the Path3D

## Methods

• 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.

• 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(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

• Returns the Path3D array of successive Vector3 designing its curve.

#### Returns Vector3[]

the Path3D array of successive Vector3 designing its curve.

• 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(): 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(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.

• 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(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

• Returns the Path3D array of successive Vector3 designing its curve.

#### Returns Vector3[]

the Path3D array of successive Vector3 designing its curve.

• 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(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(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.

• 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(): number
• #### Returns number

the computed length (float) of the path.

• 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

• 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.

## Legend

• Constructor
• Property
• Method
• Inherited constructor
• Inherited property
• Inherited method
• Property
• Method
• Static method

Theme