Skip to main content

TrailRendererLerpFollow

A class in Root.Township, the global namespace.

A LerpFollow that also drives a trail renderer, hiding the trail's head when movement is tiny.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private float baseWidthTrail width used while moving.
private float minimumDistanceSquared step length below which the trail head is hidden.
private TrailRenderer trailThe trail renderer on this object.

Methods​

MemberWhat it is
override void Start()Clears the trail and sets both its widths to baseWidth.
protected override void Moving(Vector3 from, Vector3 to)Sets the trail start width to zero when the step is shorter than minimumDistance (squared), otherwise to baseWidth.