Path
Summary
A list of transforms that usually represents a path in 3D space. These form the basis for brush strokes and camera paths
Instance Properties
Name | Return Type | Description |
---|---|---|
count | number Read-only | Returns the number of points in this path |
this[index] | Transform Read-only | Returns the point at the specified index |
last | Transform Read-only | Returns the last point in this path |
Class Methods
Path:New()
Creates a new empty Path
Returns: Path
Example
Path:New(transformList)
Creates a path from a list of Transforms
Returns: Path
Parameters:
Name | Type | Default | Description |
---|---|---|---|
transformList | Transform[] | The list of transforms |
Example
Path:New(positionList)
Creates a path from a list of Vector3 positions
Returns: Path
Parameters:
Name | Type | Default | Description |
---|---|---|---|
positionList | Vector3[] | The list of positions |
Example
Path:Hermite(startTransform, endTransform, startTangent, endTangent, resolution, tangentStrength)
Generates a hermite spline
Returns: Path (A new Path)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
startTransform | Starting transformation | ||
endTransform | End transformation | ||
startTangent | Starting tangent | ||
endTangent | End tangent | ||
resolution | number | Resolution of the spline | |
tangentStrength | number | 1 | Strength of the tangent |
Example
Instance Methods
path:GetDirection(index)
Returns a vector representing the direction of the path at the given point
Returns: Vector3
Parameters:
Name | Type | Default | Description |
---|---|---|---|
index | number | Index of control point to use |
Example
path:GetNormal(index)
Returns a vector representing the normal of the path at the given point
Returns: Vector3
Parameters:
Name | Type | Default | Description |
---|---|---|---|
index | number | Index of control point to use |
Example
path:GetTangent(index)
Returns a vector representing the tangent of the path at the given point
Returns: Vector3
Parameters:
Name | Type | Default | Description |
---|---|---|---|
index | number | Index of control point to use |
Example
path:Draw()
Draws this path as a brush stroke using current settings
Returns: nil
Example
path:Insert(transform)
Inserts a new point at the end of the path
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
transform | The transform to be inserted at the end of the path |
Example
path:Insert(transform, index)
Inserts a new point at the specified index
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
transform | The transform to be inserted | ||
index | number | The index at which to insert the transform |
Example
path:TransformBy(transform)
Transforms all points in the path by the specific amount
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
transform | The transform to be applied to all points in the path |
Example
path:TranslateBy(amount)
Changes the position of all points in the path by a given amount
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
amount | The distance to move the points |
Example
path:RotateBy(amount)
Rotates all points in the path around the origin by a given amount
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
amount | The amount by which to rotate the path |
Example
path:ScaleBy(scale)
Scales the path
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
scale | The scaling factor to apply to the path |
Example
path:Center()
Moves all points on the path so that their common center is the origin
Returns: nil
Example
path:StartingFrom(index)
Reorders the points so that point at the given index is shifted to be the first point
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
index | number | The index of the point to make the new first point |
Example
path:FindClosest(point)
Returns the index of the point closest to the given position
Returns: number
Parameters:
Name | Type | Default | Description |
---|---|---|---|
point | The 3D position that we are seeking the closest to |
Example
path:FindMinimumX()
Returns the index of the point with the smallest X value
Returns: number
Example
path:FindMinimumY()
Returns the index of the point with the smallest Y value
Returns: number
Example
path:FindMinimumZ()
Returns the index of the point with the smallest Z value
Returns: number
Example
path:FindMaximumX()
Returns the index of the point with the biggest X value
Returns: number
Example
path:FindMaximumY()
Returns the index of the point with the biggest Y value
Returns: number
Example
path:FindMaximumZ()
Returns the index of the point with the biggest Z value
Returns: number
Example
path:Normalize(size)
Scales and shifts all points so that they fit in a cube of the given size at the origin
Returns: nil
Parameters:
Name | Type | Default | Description |
---|---|---|---|
size | number | 1 | The size of the cube to fit the path into |
Example
path:SampleByDistance(spacing)
Resamples the path evenly by distance
Returns: nil (The new path)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
spacing | number | The space between points in the new path |
Example
path:SampleByCount(count)
Resamples the path evenly into the specified number of points
Returns: nil (The new path)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
count | number | The number of points in the new path |
Example
path:SubdivideSegments(parts)
Subdivides each path segment into the specified number of parts
Returns: nil (The new path)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
parts | number | Number of parts to subdivide into |
Example
Last updated