// Sonify Key public void SonifyKey() { // If chair is behind the subject, say "turn around" AimingError = Vector3.Angle(TargetPosition - Camera.main.transform.position, Camera.main.transform.forward); if (Math.Abs(AimingError) > BackThreshold) { TurnAroundSource.Play(); AimingError = 0f; } else { KeySource.pitch = Math.Max(1.5f - 0.5f * (float)Math.Log10(TargetDistance + 1f), 0.5f); KeySource.Play(); } }
// Sonify Chair public void SonifyChair() { // If chair is behind the subject, say "turn around" CalculateError(); if (Math.Abs(AimingError) > BackThreshold) { TurnAroundSource.Play(); AimingError = 0f; } else { ChairSource.pitch = Math.Max(1.5f - 0.5f * (float)Math.Log10(TargetDistance + 1f), 0.5f); ChairSource.Play(); } }