Ejemplo n.º 1
0
        private bool rotation(Frame frame)
        {
            bool  ret   = false;
            Hand  hand  = frame.Hands.Frontmost;
            Model model = models.getCurrent();

            //We have at least progressed 1 frame
            if (hand.PinchStrength >= 1f || (hand.PinchStrength > 0.8f && hand.GrabStrength == 1f))
            {
                smoother.Push(getRotation(hand));
                ret = true;
            }
            else if (hand.PinchStrength > 0.95f)
            {
                //Might be a pinch ... or not. So just minimize effect.
                smoother.Push(getRotation(hand), 0.25f);
                ret = true;
            }
            else
            {
                smoother.Push(Vector3.zero, 0.25f);
            }
            //Debug.Log(smoother.Movement);
            model.setRotation(smoother.Movement * Time.deltaTime);


            return(ret);
        }