コード例 #1
0
        // Update is called once per frame
        public void UpdateController()
        {
            if (!m_initialized)
            {
                GetPosition(m_target);
                m_initialized = true;
            }

            //Check for input
            KeyDown();
            MouseWheel();
            MouseMotion();

            double dt = Time.deltaTime * 1000.0;

            //If animation requried interpolate from start to end position
            //NOTE - has not been tested and not currently used
            if (m_animation >= 0.0)
            {
                m_animation = m_view.Interpolate(m_start.x0, m_start.y0, m_start.theta, m_start.phi, m_start.distance,
                                                 m_end.x0, m_end.y0, m_end.theta, m_end.phi, m_end.distance, m_animation);

                if (m_animation == 1.0)
                {
                    GetPosition(m_target);
                    m_animation = -1.0;
                }
            }
            else
            {
                UpdateController(dt);
            }

            //Update the view so the new positions are relected in the matrices
            m_view.UpdateView();
        }