Skip to main content

StraightPath

A class in Root.Township, Alta.Mechanisms.

A Path along a straight line centred on this transform, for sliders.

Constructors​

MemberWhat it is
StraightPath()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private Vector3 axisLocal direction of the line.
private Vector3 correctedAxisWorld direction of the line, cached by Setup.
private Vector3 minPositionWorld start of the line, cached by Setup.
private bool needsSetupTrue until Setup has run.
private Quaternion rotationThis transform's rotation, cached by Setup.
private float widthLength of the line (default 1).

Methods​

MemberWhat it is
override float GetProgress(Transform transform)Returns 0 to 1 for where a transform sits along the line's width.
override void SetTransform(Transform transform, float lerp)Places a transform on the line and gives it this path's rotation. The move is not scaled by width, so it only matches GetProgress when width is 1.
1 private and internal method
MemberWhat it is
private void Setup()Caches the rotation, world axis and start point; runs on first use.