Class LaneBuilder

Namespace
TDMaker.Unity.Authoring
Assembly
TDMaker.Unity.dll

Generates parallel sub-lanes by offsetting a center line along mitred normals.

public static class LaneBuilder
Inheritance
LaneBuilder
Inherited Members

Methods

Build(IReadOnlyList<Vector2>, int, float)

Builds laneCount lanes with matching node counts. Lane offsets are centered on the center line; lane 0 lies on the left side relative to the travel direction.

public static Vector2[][] Build(IReadOnlyList<Vector2> center, int laneCount, float spacing)

Parameters

center IReadOnlyList<Vector2>
laneCount int
spacing float

Returns

Vector2[][]

Build(IReadOnlyList<Vector2>, int, float, IReadOnlyList<float>)

Builds lanes like Build(IReadOnlyList<Vector2>, int, float), but lets individual nodes override the lane spacing. Entries of nodeSpacing that are missing or not positive use spacing.

public static Vector2[][] Build(IReadOnlyList<Vector2> center, int laneCount, float spacing, IReadOnlyList<float> nodeSpacing)

Parameters

center IReadOnlyList<Vector2>
laneCount int
spacing float
nodeSpacing IReadOnlyList<float>

Returns

Vector2[][]

Miter(IReadOnlyList<Vector2>, int)

Returns the offset direction at a node, scaled so lanes stay parallel at corners.

public static Vector2 Miter(IReadOnlyList<Vector2> center, int index)

Parameters

center IReadOnlyList<Vector2>
index int

Returns

Vector2

SpacingAt(float, IReadOnlyList<float>, int)

Returns the effective lane spacing at a node.

public static float SpacingAt(float spacing, IReadOnlyList<float> nodeSpacing, int index)

Parameters

spacing float
nodeSpacing IReadOnlyList<float>
index int

Returns

float