Пример #1
0
        public override bool Update()
        {
            Vec3f pos, fwd, right, up;
            m_Camera.GetBasis(out pos, out fwd, out right, out up);

            if (CurrentMove[0] != 0)
            {
                Vec3f dir = right;
                dir.Mul((float)CurrentMove[0]);

                m_Position.x += dir.x * CurrentSpeed;
                m_Position.y += dir.y * CurrentSpeed;
                m_Position.z += dir.z * CurrentSpeed;
            }
            if (CurrentMove[1] != 0)
            {
                Vec3f dir = new Vec3f(0.0f, 1.0f, 0.0f);
                //dir = up;
                dir.Mul((float)CurrentMove[1]);

                m_Position.x += dir.x * CurrentSpeed;
                m_Position.y += dir.y * CurrentSpeed;
                m_Position.z += dir.z * CurrentSpeed;
            }
            if (CurrentMove[2] != 0)
            {
                Vec3f dir = fwd;
                dir.Mul((float)CurrentMove[2]);

                m_Position.x += dir.x * CurrentSpeed;
                m_Position.y += dir.y * CurrentSpeed;
                m_Position.z += dir.z * CurrentSpeed;
            }

            if (CurrentMove[0] != 0 || CurrentMove[1] != 0 || CurrentMove[2] != 0)
            {
                Camera.SetPosition(m_Position);
                return true;
            }

            return false;
        }
Пример #2
0
        public override void Update()
        {
            if (CurrentMove[0] != 0)
            {
                Vec3f dir = m_Camera.Right;
                dir.Mul((float)CurrentMove[0]);

                m_Position.x += dir.x * CurrentSpeed;
                m_Position.y += dir.y * CurrentSpeed;
                m_Position.z += dir.z * CurrentSpeed;

                m_Dirty = true;
            }
            if (CurrentMove[1] != 0)
            {
                Vec3f dir = new Vec3f(0.0f, 1.0f, 0.0f);
                //dir = m_Camera.GetUp();
                dir.Mul((float)CurrentMove[1]);

                m_Position.x += dir.x * CurrentSpeed;
                m_Position.y += dir.y * CurrentSpeed;
                m_Position.z += dir.z * CurrentSpeed;

                m_Dirty = true;
            }
            if (CurrentMove[2] != 0)
            {
                Vec3f dir = m_Camera.Forward;
                dir.Mul((float)CurrentMove[2]);

                m_Position.x += dir.x * CurrentSpeed;
                m_Position.y += dir.y * CurrentSpeed;
                m_Position.z += dir.z * CurrentSpeed;

                m_Dirty = true;
            }
        }