public void Awake() { hand = GameObject.FindGameObjectWithTag("hand"); neck = GameObject.FindGameObjectWithTag("neck"); head = GameObject.FindGameObjectWithTag("head"); MagicFactory.AddMagic("throw", 0); magic = MagicFactory.GetMagic("throw"); scale = CalculateDistance(); }
public void Awake() { skeletonController = FindObjectOfType(typeof(RUISSkeletonController)) as RUISSkeletonController; skeletonManager = FindObjectOfType(typeof(RUISSkeletonManager)) as RUISSkeletonManager; hand = GameObject.FindGameObjectWithTag("hand"); neck = GameObject.FindGameObjectWithTag("neck"); head = GameObject.FindGameObjectWithTag("head"); MagicFactory.AddMagic("throw", 0); magic = MagicFactory.GetMagic("throw"); scale = CalculateDistance(); }
public void Update() { UpdatePoints(); if (!gestureEnabled) { return; } if (!gestureStarted) { ClearPoints(); cnt = 0; float dist = CalculateDistance(); if (dist < distanceTreshold) { gestureStarted = true; } } else { cnt++; if (cnt >= 60) { gestureStarted = false; } float distance = CalculateDistance(); //Debug.Log (distance + " distnace now!"); //Debug.Log (scale + " Scale now"); if (distance >= scale - requiredConfidence && distance <= scale + requiredConfidence) { startCnt = true; gestureStarted = false; } } if (startCnt) { cnt2++; if (cnt2 == 5) { cnt2 = 0; startCnt = false; Magic magic = MagicFactory.GetMagic("throw"); magic.TryActivate(); } } }
void Update() { //Debug.Log (System.Threading.Thread.CurrentThread.ManagedThreadId); //Debug.Log (ruisInput.points [ruisInput.points.Count - 1].position); gestureState = false; if (ruisInput.points.Count > 10 && Mathf.Abs(ruisInput.AverageCord(3) - head.transform.position.z) > distanceTreshold) { //NOT SURE IF WE NEED TO check in each iteration. maybe once in some number string recognized = dtwGestures.Recognize(ruisInput.points, colliders); if (!recognized.Contains("UNKNOWN")) { Magic magic = MagicFactory.GetMagic(recognized); magic.TryActivate(); gestureState = true; } } }