Splineclass

Collection of curves in 3D space. Shape and behavior of the curves are controled through points `Sandbox.Spline.Point`, each with customizable handles, roll, scale, and up vectors. Two consecutive points define a segment/curve of the spline. By adjusting the handles both smooth and sharp corners can be created. The spline can also be turned into a loop, combined with linear tangents this can be used to create polygons. Splines can also be used used for animations, camera movements, marking areas, or procedural geometry generation.

object→Spline
Namespace
Sandbox
Assembly
Sandbox.System
Declaration
public class Sandbox.Spline

Constructors1

Showing 1 constructors

public Spline()PUBLICCONSTRUCTOR

Methods14

Showing 14 methods

public void AddPoint(Sandbox.Spline.Point newPoint)PUBLIC

Adds a point to the end of the spline.

ParameterTypeDescription
newPointPoint—
Returns:void—

public int AddPointAtDistance(float distance, bool inferTangentModes = False)PUBLIC

Adds a point at a specific distance along the spline. Returns the index of the added spline point. Tangents of the new point and adjacent points will be calculated so the spline shape remains the same. Unless inferTangentModes is set to true, in which case the tangent modes will be inferred from the adjacent points.

ParameterTypeDescription
distancefloat—
inferTangentModes = Falsebool—
Returns:int—

public void Clear()PUBLIC

Removes all points from the spline.

Returns:void—

public float GetDistanceAtPoint(int pointIndex)PUBLIC

Fetches how far along the spline a point is.

ParameterTypeDescription
pointIndexint—
Returns:float—

public Sandbox.Spline.Point GetPoint(int pointIndex)PUBLIC

Access the information about a spline point.

ParameterTypeDescription
pointIndexint—
Returns:Point—

public BBox GetSegmentBounds(int segmentIndex)PUBLIC

Bounds of an individual spline segment.

ParameterTypeDescription
segmentIndexint—
Returns:BBox—

public float GetSegmentLength(int segmentIndex)PUBLIC

Fetches the length of an individual spline segment.

ParameterTypeDescription
segmentIndexint—
Returns:float—

public void InsertPoint(int pointIndex, Sandbox.Spline.Point newPoint)PUBLIC

Adds a point at an index

ParameterTypeDescription
pointIndexint—
newPointPoint—
Returns:void—

public void RemovePoint(int pointIndex)PUBLIC

Removes the point at the specified index.

ParameterTypeDescription
pointIndexint—
Returns:void—

public Sandbox.Spline.Sample SampleAtClosestPosition(Vector3 position)PUBLIC

Calculates a bunch of information about the spline at the position closest to the specified position.

ParameterTypeDescription
positionVector3—
Returns:Sample—

public Sandbox.Spline.Sample SampleAtDistance(float distance)PUBLIC

Calculates a bunch of information about the spline at a specific distance.

ParameterTypeDescription
distancefloat—
Returns:Sample—

public void UpdatePoint(int pointIndex, Sandbox.Spline.Point updatedPoint)PUBLICPER-FRAME

Update the information stored at a spline point.

ParameterTypeDescription
pointIndexint—
updatedPointPoint—
Returns:void—

Properties5

Showing 5 properties

public BBox Sandbox.Spline.Bounds { get; set; }PUBLICGETSET

Total bounds of the spline.

Returns:BBox—

public bool Sandbox.Spline.IsLoop { get; set; }PUBLICGETSET

Whether the spline forms a loop.

Returns:bool—

public float Sandbox.Spline.Length { get; set; }PUBLICGETSET

Total length of the spline.

Returns:float—

public int Sandbox.Spline.PointCount { get; set; }PUBLICGETSET

Number of points in the spline.

Returns:int—

public int Sandbox.Spline.SegmentCount { get; set; }PUBLICGETSET

Number of segments in the spline, a spline contains one less segment than points.

Returns:int—

On this page