A class in Root.Township, the global namespace.
Trigger that builds up a drag offset from a solid collider moving through it, and lets it ease back when nothing touches it. Read DragPull.
Constructors
| Member | What it is |
|---|
DragTrigger() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|
private Collider currentDragger | Unused field; CurrentDragger is an auto property. |
private AltaCoroutine dragUpdater | The running drag update coroutine. |
private HashSet<Collider> intersectingColliders | Colliders inside the trigger. |
private float maxDistanceDropoff | Exponent that slows the ease back as the pull gets small. |
private float maxDragDistance | Pull size below which easing back slows down. |
private float maxDragSpeed | Most the pull can change per second. |
private Vector3 oldDraggerPosition | Dragger position on the last frame. |
Properties
| Member | What it is |
|---|
Vector3 DragPull { get; private set; } | Total drag offset built up so far. It eases back to zero when nothing drags. |
1 private and internal property
| Member | What it is |
|---|
private Collider CurrentDragger { get; set; } | The collider currently dragging. |
Methods
5 private and internal methods
| Member | What it is |
|---|
private void OnDestroy() | Stops the drag update coroutine. |
private void OnTriggerEnter(Collider other) | Adds a solid collider that has no DragTrigger of its own. |
private void OnTriggerExit(Collider other) | Removes the collider and clears it if it was dragging. |
private void Start() | Starts the drag update coroutine. |
private IEnumerator UpdateDragPull() (iterator) | Each frame, adds the dragger's movement to DragPull (speed capped), or eases it back when none. |
Used in
Members of other types that take, return or hold a DragTrigger: