Skip to main content

TransformDeltaChangeChecker

A class in Root.Township, the global namespace.

Watches a set of transforms and fires AllTransformsFrozen once none has moved or turned more than a small amount for long enough. Probably used for pose detection.

Constructors​

MemberWhat it is
TransformDeltaChangeChecker(IEnumerable<Transform> transformsToCheck, float maxLocalPositionDelta, float maxLocalRotationDelta, float minTimeToRegisterFreeze)Creates a TransformDeltaChangeChecker from transformsToCheck, maxLocalPositionDelta, maxLocalRotationDelta and minTimeToRegisterFreeze.

Fields​

7 private and internal fields
MemberWhat it is
private float maxLocalPositionDeltaLargest per-frame local move that still counts as still.
private float maxLocalRotationDeltaLargest per-frame local rotation in degrees that still counts as still.
private float minTimeToRegisterFreezeSeconds everything must stay still before the event fires.
private float poseFreezeStartTimeTime the current still period began, or 0.
private AltaCoroutine poseTriggerCheckingThe running check coroutine.
private Dictionary<Transform, TransformSave> transformSavesLast saved local pose per transform.
private IEnumerable<Transform> transformsToCheckThe transforms being watched.

Events​

MemberWhat it is
event Action AllTransformsFrozenRaised each time the transforms have stayed still for the minimum time.

Methods​

MemberWhat it is
void StartCheckingForFreeze(MonoBehaviour behaviourToRunCheckingRoutineOn)Saves the current poses and starts the check coroutine on the given behaviour.
void StopChecking()Stops the check coroutine.
3 private and internal methods
MemberWhat it is
private IEnumerator CheckForPoseTrigger() (iterator)Coroutine that compares each frame to the last, times how long all stay still and fires the event.
private bool HasTransformChanged(Transform transform)True if a transform moved or rotated more than the limits since the last save. Throws if it was destroyed.
private void SaveTransforms()Stores each transform's local position and rotation for the next comparison.

Used in​

Members of other types that take, return or hold a TransformDeltaChangeChecker: