Skip to main content

BeltVisual

A class in Root.Township, the global namespace.

Visual for a pulley Belt in a parent object. The base version only draws the belt path with debug lines when the belt rotates; subclasses draw the real thing.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private float maximumSegmentLengthLongest straight segment between points.
private float segmentsPerDegreeHow many points to use per degree of wrap around a pulley.

Properties​

MemberWhat it is
Belt Belt { get; private set; }The Belt found in the parents.

Methods​

MemberWhat it is
virtual void DrawConnections()Draws the belt's rope path with Debug.DrawLine (closing segment in blue). Virtual.
protected virtual void Awake()Finds the parent belt and redraws whenever it rotates.
protected void GetBelt()Finds the Belt in the parents.
protected IEnumerable<Vector3> GetPoints()Points along the belt wrapped around its connected turnables, from PulleyBeltHelper.GetRope.