Struct Cursor

Public

Represents a single point on the polyline represented by the PathInterpolator.

The cursor is a lightweight structure which can be used to move backwards and forwards along a PathInterpolator.

If the PathInterpolator changes (e.g. has its path swapped out), then this cursor is invalidated and cannot be used anymore.

Public Methods

AssertValid ()
Public
EstimateSmoothCurvature (tangent, smoothingDistance, expectedRadius)
Public
EstimateSmoothTangent (normalizedTangent, smoothingDistance, expectedRadius, beforePathStartContribution, forward=true, backward=true)
Public
GetRemainingPath (buffer)

Appends the remaining path between position and endPoint to buffer.

Public
GetTangents (t1, t2)

The tangent(s) of the curve at the current position.

Public
MoveToCircleIntersection2D<T> (circleCenter3D, radius, transform)
Public
MoveToClosestIntersectionWithLineSegment (origin, direction, range)

Moves to the closest intersection of the line segment (origin + direction*range.x, origin + direction*range.y).

Public
MoveToClosestPoint (point)

Move as close as possible to the specified point.

Public
MoveToLocallyClosestPoint (point, allowForwards=true, allowBackwards=true)
Public
MoveToNextCorner ()

Moves the cursor to the next geometric corner in the path.

Public
MoveToSegment (index, fractionAlongSegment)

Move to the specified segment and move a fraction of the way to the next segment.

Public
MoveWithTurningSpeed (time, speed, turningSpeed, tangent)

Moves the agent along the path, stopping to rotate on the spot when the path changes direction.

Public
NextSegment ()
Public
PrevSegment ()
Public

Public Static Methods

IntegrateSmoothTangent (p1, p2, tangent, distance, expectedRadius, smoothingDistance)
Public Static
IntegrateSmoothingKernel (a, b, smoothingDistance)

Integrates exp(-|x|/smoothingDistance)/(2*smoothingDistance) from a to b.

Public Static
IntegrateSmoothingKernel2 (a, b, smoothingDistance)

Integrates (x - a)*exp(-x/smoothingDistance)/(2*smoothingDistance) from a to b.

Public Static
StartOfPath (interpolator)

A cursor at the start of the polyline represented by the interpolator.

Public Static

Public Variables

curvatureDirection

A vector parallel to the local curvature.

Public
distance

Traversed distance from the start of the path.

Public
endPoint

Last point in the path.

Public
fractionAlongCurrentSegment

Fraction of the way along the current segment.

Public
position

Current position.

Public
remainingDistance

Remaining distance until the end of the path.

Public
segmentCount
Public
segmentIndex

Current segment.

Public
tangent

Tangent of the curve at the current position.

Public
valid

True if this instance has a path set.

Public

Private/Protected Members

currentDistance
Private
currentSegmentLength
Private
distanceToSegmentStart
Private
interpolator
Private
version
Private