예제 #1
0
        protected override void Draw(Settings settings)
        {
            base.Draw(settings);

            m_debugDraw.DrawString(5, m_textLine, "Press 1-5 to drop stuff");
            m_textLine += 15;

            float  L      = 25.0f;
            b2Vec2 point1 = new b2Vec2(0.0f, 10.0f);
            b2Vec2 d      = new b2Vec2(L * (float)Math.Cos(m_angle), -L * b2Math.b2Abs((float)Math.Sin(m_angle)));
            b2Vec2 point2 = point1 + d;

            EdgeShapesCallback callback = new EdgeShapesCallback();

            m_world.RayCast(callback, point1, point2);

            if (callback.m_fixture != null)
            {
                m_debugDraw.DrawPoint(callback.m_point, 5.0f, new b2Color(0.4f, 0.9f, 0.4f));

                m_debugDraw.DrawSegment(point1, callback.m_point, new b2Color(0.8f, 0.8f, 0.8f));

                b2Vec2 head = callback.m_point + 0.5f * callback.m_normal;
                m_debugDraw.DrawSegment(callback.m_point, head, new b2Color(0.9f, 0.9f, 0.4f));
            }
            else
            {
                m_debugDraw.DrawSegment(point1, point2, new b2Color(0.8f, 0.8f, 0.8f));
            }
        }
예제 #2
0
        protected override void Draw(Settings settings)
        {
            base.Draw(settings);

            m_debugDraw.DrawString(5, m_textLine, "Press 1-5 to drop stuff");
            m_textLine += 15;

            float L = 25.0f;
            b2Vec2 point1 = new b2Vec2(0.0f, 10.0f);
            b2Vec2 d = new b2Vec2(L * (float)Math.Cos(m_angle), -L * b2Math.b2Abs((float)Math.Sin(m_angle)));
            b2Vec2 point2 = point1 + d;

            EdgeShapesCallback callback = new EdgeShapesCallback();

            m_world.RayCast(callback, point1, point2);

            if (callback.m_fixture != null)
            {
                m_debugDraw.DrawPoint(callback.m_point, 5.0f, new b2Color(0.4f, 0.9f, 0.4f));

                m_debugDraw.DrawSegment(point1, callback.m_point, new b2Color(0.8f, 0.8f, 0.8f));

                b2Vec2 head = callback.m_point + 0.5f * callback.m_normal;
                m_debugDraw.DrawSegment(callback.m_point, head, new b2Color(0.9f, 0.9f, 0.4f));
            }
            else
            {
                m_debugDraw.DrawSegment(point1, point2, new b2Color(0.8f, 0.8f, 0.8f));
            }
        }