Color legend plain property method
A smooth curve through waypoints, measured so that equal distances along it are equal lengths of curve, with an orientation at every point, and timed with its waypoints’ easing and holds.
A sealed class. The camera paths page shows it in context, with code, and the drawing a path page how to draw it.
Names are colored by what they are: a property or a method; values and fields keep the plain color.
Properties
Closed →
bool · Whether the path loops from its last waypoint back to its first. Takes effect with three waypoints or more, see IsClosed. Off by default. Changing it marks the path for rebuilding.
IsClosed →
bool · Read-only. Whether the path really loops: Closed is set and it has at least three waypoints.
IsVisualized →
bool · Whether the path keeps VisualGeometryBuffers current. Turning it on builds the geometry; turning it off empties it. Off by default.
Length →
float · Read-only. The length of the whole curve, in world units; 0 with fewer than two waypoints. Reading it rebuilds the path if it changed.
SegmentCount →
int · Read-only. The number of segments: one fewer than the waypoints for an open path, as many for a loop, 0 for fewer than two waypoints.
VisualGeometryBuffers →
CameraPathGeometryBuffers · Read-only. The geometry to draw the path, built again on this read when the path or VisualOptions changed. Empty while IsVisualized is off. Always the same instance.
VisualOptions →
CameraPathVisualOptions · How the geometry is built. Default by default. A struct: assign a changed copy, which marks the geometry for building again.
Waypoints →
IReadOnlyList<CameraWaypoint> · Read-only. The waypoints in path order, as a read-only view. Edit them with AddWaypoint, InsertWaypoint, SetWaypoint, RemoveWaypointAt and ClearWaypoints.
WorldUp →
Vector3 · The up that LookAtTarget and TangentFollow waypoints level their roll against. Vector3.Up by default. Changing it marks the path for rebuilding.
Methods
CameraPath() →
CameraPath(int samplesPerSegment = 32) · An empty path. Throws ArgumentOutOfRangeException when samplesPerSegment is less than 1.
| Parameter | Type | Description |
|---|---|---|
samplesPerSegment |
int |
How finely each segment is measured. Default: 32, which keeps the speed within 0.15 % of constant; each doubling cuts the placement error more than tenfold, up to around 64. |
AddWaypoint() →
AddWaypoint(CameraWaypoint waypoint) · Adds a waypoint at the end and marks the path for rebuilding.
| Parameter | Type | Description |
|---|---|---|
waypoint |
CameraWaypoint |
The waypoint to add. |
ClearWaypoints() →
ClearWaypoints() · Removes every waypoint and marks the path for rebuilding.
ClosestDistance() →
ClosestDistance(Vector3 worldPosition) · The distance along the path of its point nearest the position: a scan of every point the path is measured at, then a refinement between the best one’s neighbors. 0 for a path with fewer than two waypoints.
| Parameter | Type | Description |
|---|---|---|
worldPosition |
Vector3 |
The position, in world coordinates. |
CruiseSpeed() →
CruiseSpeed(float durationSec) · The cruise speed at which one run takes the duration, the inverse of TravelTime: the holds take their seconds, and the travel takes the rest, but at least a tenth of the duration, so holds that alone would fill it leave the run that much longer. 0 for a duration of 0 or less, or a path of length 0. The animated camera timed by duration plays its DurationSec at this speed.
| Parameter | Type | Description |
|---|---|---|
durationSec |
float |
The seconds one run should take, easing and holds included. |
DistanceAtTime() →
DistanceAtTime(float seconds, float cruiseSpeed) · The distance along the path the seconds into a run at the cruise speed, easing and holds included; without either, the speed times the seconds. 0 before the run, Length once it is over, and 0 for a path with no segment or a speed of 0 or less. A curve that overshoots, such as a back or elastic ease, takes the speed below zero for a moment and the distance a little past the waypoint it eases and back, so out of 0 to Length at an end of an open path; sampling clamps it there.
| Parameter | Type | Description |
|---|---|---|
seconds |
float |
The time into the run. |
cruiseSpeed |
float |
The speed wherever no waypoint eases, in world units a second. |
EaseStretch() →
EaseStretch(BaseShapingFunction? curve, bool arriving) · Static. How many times longer than at cruise speed a half segment eased by the curve takes, the rule TravelTime times a path by: the inverse of the curve’s average speed. 2 for Linear and every ease in-out, 3 for a quadratic ease in leaving or a quadratic ease out arriving, 1.5 the other way round, and between a hundredth and a hundred for any curve. 1 for null, and for a curve that on the whole goes nowhere or backwards, which travels its half at cruise speed. For whatever needs to show the timing.
| Parameter | Type | Description |
|---|---|---|
curve |
BaseShapingFunction? |
The speed curve, as a waypoint’s EaseIn or EaseOut holds it. |
arriving |
bool |
false for the half leaving a waypoint, where the speed is the curve; true for the half arriving at one, where it is 1 minus the curve. |
GetWaypointOrientation() →
GetWaypointOrientation(int index) · The orientation the waypoint resolves to, the one the path has there: its own for Fixed, worked out from its target or the curve for LookAtTarget and TangentFollow. Works for a lone waypoint too. Throws ArgumentOutOfRangeException for an index out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The waypoint’s index in Waypoints. |
InsertWaypoint() →
InsertWaypoint(int index, CameraWaypoint waypoint) · Inserts a waypoint at the index and marks the path for rebuilding; the waypoints from there on move up by one. Throws ArgumentOutOfRangeException for an index below 0 or above the count.
| Parameter | Type | Description |
|---|---|---|
index |
int |
Where the new waypoint goes. The count adds it at the end. |
waypoint |
CameraWaypoint |
The waypoint to insert. |
PositionByPathDistance() →
PositionByPathDistance(float pathDistance) · The position alone at the distance along the path, clamped to 0 to Length: the origin for an empty path, the waypoint for a lone one.
| Parameter | Type | Description |
|---|---|---|
pathDistance |
float |
In world units from the first waypoint. |
PositionByPathDistanceNormalized() →
PositionByPathDistanceNormalized(float value) · The position alone at a fraction of the path’s length.
| Parameter | Type | Description |
|---|---|---|
value |
float |
0 for the start, 1 for the end; clamped to 0 to 1. |
Rebuild() →
Rebuild() · Measures the path now: its length, its distance table, its waypoint orientations, its timing and, while IsVisualized is on, its geometry. Edits schedule it for the next query on their own; call it to pay the cost at a moment of your choosing.
RemoveWaypointAt() →
RemoveWaypointAt(int index) · Removes the waypoint at the index and marks the path for rebuilding. Throws ArgumentOutOfRangeException for an index out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The waypoint’s index in Waypoints. |
SampleByPathDistance() →
SampleByPathDistance(float pathDistance) · A CameraPathPoint: the position, direction and orientation at the distance along the path, clamped to 0 to Length, on a closed path too. A lone waypoint gives its own position and orientation; an empty path, the origin facing −Z.
| Parameter | Type | Description |
|---|---|---|
pathDistance |
float |
In world units from the first waypoint. |
SampleByPathDistanceNormalized() →
SampleByPathDistanceNormalized(float value) · The same at a fraction of the path’s length.
| Parameter | Type | Description |
|---|---|---|
value |
float |
0 for the start, 1 for the end; clamped to 0 to 1. |
SetWaypoint() →
SetWaypoint(int index, CameraWaypoint waypoint) · Replaces the waypoint at the index and marks the path for rebuilding. Throws ArgumentOutOfRangeException for an index out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The waypoint’s index in Waypoints. |
waypoint |
CameraWaypoint |
The waypoint to put there. |
SpeedAtTime() →
SpeedAtTime(float seconds, float cruiseSpeed) · The camera’s speed, in world units a second, the seconds into a run at the cruise speed: the cruise speed wherever no waypoint eases, 0 while one holds and outside the run, below 0 where an overshooting curve backs the camera up. Read off the easing speed curve itself rather than from distances a moment apart. Where the speed jumps, as at a waypoint eased on one side only, the moment of the jump gives the speed after it. 0 for a path with no segment or a speed of 0 or less.
| Parameter | Type | Description |
|---|---|---|
seconds |
float |
The time into the run. |
cruiseSpeed |
float |
The speed wherever no waypoint eases, in world units a second. |
TimeAtDistance() →
TimeAtDistance(float pathDistance, float cruiseSpeed) · The seconds into a run at the cruise speed when the camera reaches the distance, the inverse of DistanceAtTime, for starting a run partway along. At a waypoint that holds, the time the camera arrives, so a run started there holds first. Where an overshooting curve passes the same point more than once, the first time. 0 for a path with no segment or a speed of 0 or less.
| Parameter | Type | Description |
|---|---|---|
pathDistance |
float |
In world units from the first waypoint; clamped to 0 to Length. |
cruiseSpeed |
float |
The speed wherever no waypoint eases, in world units a second. |
TravelTime() →
TravelTime(float cruiseSpeed) · The seconds one run takes at the cruise speed, easing and holds included. Without easing, the travel is Length over the speed. A curve is the camera’s speed over its half’s time, so each eased half takes the inverse of its average speed in cruise times, EaseStretch: twice its cruise time for Linear, three times for a quadratic ease in leaving, four for a cubic, and at most a hundred. Every waypoint’s HoldSec is added as it is, whatever the speed. 0 for a path with no segment, infinity for a speed of 0 or less. The animated camera timed by speed takes this long for a run at its SpeedUnitsPerSec.
| Parameter | Type | Description |
|---|---|---|
cruiseSpeed |
float |
The speed wherever no waypoint eases, in world units a second. |
WaypointArrivalTime() →
WaypointArrivalTime(int index, float cruiseSpeed) · The seconds into a run at the cruise speed when the camera reaches the waypoint, before its HoldSec, see WaypointDepartureTime. Exact, read off the path’s own tables, where timing the waypoint’s distance with TimeAtDistance can come out a little off. The first waypoint is reached at 0, a run starting on it; on a closed path the end of the run brings the camera back to it too, and its hold comes at the start. 0 for a path with no segment or a speed of 0 or less. Throws ArgumentOutOfRangeException for an index out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The waypoint’s index in Waypoints. |
cruiseSpeed |
float |
The speed wherever no waypoint eases, in world units a second. |
WaypointDepartureTime() →
WaypointDepartureTime(int index, float cruiseSpeed) · The seconds into a run at the cruise speed when the camera leaves the waypoint: its WaypointArrivalTime plus its HoldSec, the same moment for one that doesn’t hold. For the last waypoint of an open path, the end of the run. Throws ArgumentOutOfRangeException for an index out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The waypoint’s index in Waypoints. |
cruiseSpeed |
float |
The speed wherever no waypoint eases, in world units a second. |
WaypointDistance() →
WaypointDistance(int index) · The distance along the path of the waypoint, where the path passes exactly through it: exact, where ClosestDistance of its position can come out a hair off. The first waypoint is at 0; on a closed path also at Length, where the loop comes back to it. 0 for a path with fewer than two waypoints. Throws ArgumentOutOfRangeException for an index out of range.
| Parameter | Type | Description |
|---|---|---|
index |
int |
The waypoint’s index in Waypoints. |