Skip to main content

BendPath

A class in Root.Township, Alta.Mechanisms.

A Path that moves an object along an arc around a pivot, for curved sliders and levers.

Constructors​

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

Fields​

12 private and internal fields
MemberWhat it is
private float angleRangeTotal angle of the arc in degrees (default 60).
private Vector3 facingDirectionLocal direction the moved object faces, turned along the arc.
private Vector3 initializedPivotDirectionWorld direction to the pivot, cached by Setup.
private Vector3 minPositionDirection from the pivot to the start of the arc, cached by Setup.
private bool needsSetupTrue until Setup has run.
private Vector3 pivotWorld pivot point, cached by Setup.
private Vector3 pivotDirectionLocal direction from this transform to the pivot.
private float pivotDistanceDistance from this transform to the pivot.
private float radiusArc radius the object is placed at.
private Vector3 rotationAxisLocal axis the arc turns around.
private Quaternion selfRotationThis transform's rotation, cached by Setup.
private Vector3 upWorld rotation axis, cached by Setup.

Methods​

MemberWhat it is
override float GetProgress(Transform transform)Returns 0 to 1 for where a transform sits along the arc, clamped at the ends.
override void SetTransform(Transform transform, float lerp)Places and rotates a transform on the arc at the given 0 to 1 progress.
1 private and internal method
MemberWhat it is
private void Setup()Caches the pivot point, axis and start direction from the current transform; runs on first use.