예제 #1
0
파일: LeapManager.cs 프로젝트: jceipek/ORGI
    void Update()
    {
        Frame frame = m_controller.Frame();

        // update the pointer controller
        ToolList tools = frame.Tools;

        if (m_pointerController)
        {
            if (tools.Count > 0)
            {
                Tool tool = tools[0];
                // leap motion uses different object for vectors
                Vector3 positionVector = new Vector3(tool.TipPosition.x, tool.TipPosition.y, tool.TipPosition.z);
                m_pointerController.ToolMoved(positionVector);
            }

            // do something with the tracking data in the frame...
            GestureList gestures = frame.Gestures();
            if (gestures.Count > 0)
            {
                foreach (Gesture gesture in gestures)
                {
                    if (gesture.State == Gesture.GestureState.STATESTOP)
                    {
                        m_pointerController.Gesture(gesture);
                        Debug.Log(gesture.Type + " : " + gesture.Duration);
                    }
                }
            }
        }
    }