From 1cbea0adc86e8f66422b0d9a6655cb7e9f37392d Mon Sep 17 00:00:00 2001 From: Alexis Iakovenko <alexis.iakovenko@gmail.com> Date: Sat, 6 Jan 2018 14:29:28 +0100 Subject: [PATCH] Use dynamic threshold based on initial coordinates --- Assets/Compare/LiveComparer.cs | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Assets/Compare/LiveComparer.cs b/Assets/Compare/LiveComparer.cs index 3cb90c6..b962631 100644 --- a/Assets/Compare/LiveComparer.cs +++ b/Assets/Compare/LiveComparer.cs @@ -24,6 +24,7 @@ public class LiveComparer : MonoBehaviour public void ResetScore() { + acceptableScore = frameScore - 1.0f; totalScore = 0.0f; frameScore = 0.0f; sumScore = 0.0f; @@ -51,8 +52,8 @@ public class LiveComparer : MonoBehaviour //for now we only consider the left hand frameScore = 100.0f; - float positionFactor = 10.0f; - float rotationFactor = 5.0f; + float positionFactor = 15.0f; + float rotationFactor = 15.0f; Vector3 differencePosition = leftPalmPosition - replay.gestureToReplay.states [replay.currentFrame].position; @@ -102,14 +103,22 @@ public class LiveComparer : MonoBehaviour frameScoreLabel.GetComponent<Text> ().text = "frame score: " + frameScore.ToString (); totalScoreLabel.GetComponent<Text> ().text = "total score: " + totalScore.ToString (); - if (frameScore > acceptableScore) - frameScoreLabel.GetComponent<Text> ().color = new Color (0.0f, 0.7f, 0.0f); + if (replay.currentFrame == 0) + { + frameScoreLabel.GetComponent<Text> ().color = new Color (0.0f, 0.0f, 0.0f); + totalScoreLabel.GetComponent<Text> ().color = new Color (0.0f, 0.0f, 0.0f); + } else - frameScoreLabel.GetComponent<Text> ().color = new Color (0.7f, 0.0f, 0.0f); + { + if (frameScore > acceptableScore) + frameScoreLabel.GetComponent<Text> ().color = new Color (0.0f, 0.7f, 0.0f); + else + frameScoreLabel.GetComponent<Text> ().color = new Color (0.7f, 0.0f, 0.0f); - if (totalScore > acceptableScore) - totalScoreLabel.GetComponent<Text> ().color = new Color (0.0f, 0.7f, 0.0f); - else - totalScoreLabel.GetComponent<Text> ().color = new Color (0.7f, 0.0f, 0.0f); + if (totalScore > acceptableScore) + totalScoreLabel.GetComponent<Text> ().color = new Color (0.0f, 0.7f, 0.0f); + else + totalScoreLabel.GetComponent<Text> ().color = new Color (0.7f, 0.0f, 0.0f); + } } } -- GitLab