Options
All
• Public
• Public/Protected
• All

Class Path3D

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

see

https://doc.babylonjs.com/divingDeeper/mesh/path3D

• Path3D

Constructors

constructor

• 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

pathSearch playground for path

path: Vector3[]

an array of Vector3, the curve axis of the Path3D

Methods

getBinormalAtSearch playground for getBinormalAt

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

getBinormalsSearch playground for getBinormals

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

getClosestPositionToSearch playground for getClosestPositionTo

• 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

getCurveSearch playground for getCurve

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

Returns Vector3[]

the Path3D array of successive Vector3 designing its curve.

getDistanceAtSearch playground for getDistanceAt

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

getDistancesSearch playground for getDistances

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

getNormalAtSearch playground for getNormalAt

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

getNormalsSearch playground for getNormals

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

getPointAtSearch playground for getPointAt

• 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

getPointsSearch playground for getPoints

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

Returns Vector3[]

the Path3D array of successive Vector3 designing its curve.

getPreviousPointIndexAtSearch playground for getPreviousPointIndexAt

• 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

getSubPositionAtSearch playground for getSubPositionAt

• 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

getTangentAtSearch playground for getTangentAt

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

getTangentsSearch playground for getTangents

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

lengthSearch playground for length

• length(): number
• Returns number

the computed length (float) of the path.

sliceSearch playground for slice

• 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
• Property
• Method
• Inherited property
• Inherited method
• Static property
• Static method