Skip to main content

HandShakeOffDetector

A class in Root.Township, Alta.Heat.

Scores how hard a hand (or other transform) is shaking, from its speed through a curve. MovementHeatPoint uses the score to shed heat faster when you shake a burning hand. Server side; a component on the hand, reached through Hand.ShakeDetector.

Constructors​

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

Fields​

8 private and internal fields
MemberWhat it is
private HashSet<Object> activatorsObjects that have requested the detector; it runs while any remain.
private bool isLocalPositionIf true, measures local position, so moving the whole player doesn't count.
private Vector3 lastPositionTarget position on the last physics step.
private float lerpToScorePerSecondHow fast score eases toward the curve value.
private float scoreBacking field for Score.
private AnimationCurve shakeScoreCurve from speed to shake score.
private Transform targetTransformTransform whose movement is measured.
private LocomotionController teleportControllerLocomotion controller watched for teleports.

Properties​

MemberWhat it is
float Score { get; }Current shake score, eased toward the curve value each physics step.

Methods​

MemberWhat it is
override void InitializeAsServer(SpawnData spawnData)When tracking world position, hooks the teleport controller so teleports don't count as shaking.
void Release(Object activator)Removes an activator; when none are left, resets the score and disables the detector.
void Request(Object activator)Adds an activator; the first one resets the score and enables the detector.
3 private and internal methods
MemberWhat it is
private void FixedUpdate()While enabled, measures the target's speed, maps it through shakeScore and eases score toward it.
private bool Setup()Editor setup: defaults the target to this transform and starts the component disabled.
private void UpdatePosition(PlayerController player, Vector3 oldPosition, Vector3 newPosition, LocomotionFunction function)Shifts the last position by a teleport's offset so the jump isn't scored as movement.

Used in​

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