s&box docs

public class Sandbox.Spline

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.

Broader workflow and conceptual references connected to this API.

Constructors

Showing 1 constructors

Methods

Showing 14 methods

public void AddPoint(Sandbox.Spline.Point newPoint)

Adds a point to the end of the spline.

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

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.

Parameters

  • inferTangentModes: Default: False

public void Clear()

Removes all points from the spline.

public float GetDistanceAtPoint(int pointIndex)

Fetches how far along the spline a point is.

public Sandbox.Spline.Point GetPoint(int pointIndex)

Access the information about a spline point.

public BBox GetSegmentBounds(int segmentIndex)

Bounds of an individual spline segment.

public float GetSegmentLength(int segmentIndex)

Fetches the length of an individual spline segment.

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

Adds a point at an index

public void RemovePoint(int pointIndex)

Removes the point at the specified index.

public Sandbox.Spline.Sample SampleAtClosestPosition(Vector3 position)

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

public Sandbox.Spline.Sample SampleAtDistance(float distance)

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

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

Update the information stored at a spline point.

Properties

Showing 5 properties

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

Total bounds of the spline.

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

Whether the spline forms a loop.

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

Total length of the spline.

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

Number of points in the spline.

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

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

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.System
Doc IDT:Sandbox.Spline

On this page