// Update is called once per frame void Update() { if (tracking) { if (gameObject.GetComponent <Tracker>().TrackerStatus != 0) { /////////////////////////////////////////////////////////////////////////////////////////////////////// // Emotions are acqured here! Be extremely careful about making any changes to these two lines! // The entire emotion system depends on these working successfully. IntPtr nums = VisageTrackerNative._getEmotions(); // Due to cross language type mangling, we have to marshal the result into something we can use. Marshal.Copy(nums, probs, 0, 6); /////////////////////////////////////////////////////////////////////////////////////////////////////// FileManagement.dump(probs); if (probs[0] != -9999) // -9999 is the "error" code from the plugin. { for (int i = 0; i < probs.Length; i++) { // Truncate to three places for easier display probs[i] = (float)Math.Truncate(1000 * probs[i]) / 1000; } haveRecentData = true; } else { haveRecentData = false; currentState = AffectiveStates.None; } } else { haveRecentData = false; } // If we have gotten recent data, and are not waiting for the next wave, analyse it. if (haveRecentData && !waitForWave) { analyzeData(); } } }