private void TwoFeet() { // convert echoes to screen position Vector2 e0 = UnityTracking.TrackingAdapter.GetScreenPositionFromRelativePosition(Echoes[0].x, Echoes[0].y); Vector2 e1 = UnityTracking.TrackingAdapter.GetScreenPositionFromRelativePosition(Echoes[1].x, Echoes[1].y); // feet crossed check 1 // check if left foot is left of center considering movement direction // TODO: combine with HMD orientation if (correctCrossing) { if (!IsLeftOfCenter(e0 * _scaling) /* || !IsLeftOfCenter(e1 * _scaling)*/) { VectorHelpers.Swap(ref e0, ref e1); //ReinitializeAllFilters(); } } // scale to used space leftFootPosition = new Vector3(e0.x, 0, e0.y) * _scaling; //DebugText.SetText((leftFootPosition - lastLeftFootPosition).magnitude.ToString()); //print((leftFootPosition - lastLeftFootPosition).magnitude); rightFootPosition = new Vector3(e1.x, 0, e1.y) * _scaling; // feet crossed check 2 // checking if new foot position is closer own last position than other foot last position if (correctCrossing) { if (Vector2.Distance(leftFootPosition, lastLeftFootPosition) > Vector2.Distance(leftFootPosition, lastRightFootPosition) && Vector2.Distance(rightFootPosition, lastRightFootPosition) > Vector2.Distance(rightFootPosition, lastLeftFootPosition)) { VectorHelpers.Swap(ref leftFootPosition, ref rightFootPosition); //ReinitializeAllFilters(); } } }