Пример #1
0
    public override void Step(Box2D.XNA.TestBed.Framework.Settings settings)
    {
        ContactManager cm               = _world.GetContactManager();
        int            height           = cm._broadPhase.ComputeHeight();
        int            leafCount        = cm._broadPhase.ProxyCount;
        int            minimumNodeCount = 2 * leafCount - 1;
        float          minimumHeight    = (float)(Math.Ceiling(Math.Log((double)minimumNodeCount) / Math.Log(2.0)));

        _debugDraw.DrawString(5, _textLine, string.Format("dynamic tree height = {0}, min = {1}", height, minimumHeight));
        _textLine += 15;

        base.Step(settings);
    }
Пример #2
0
        public override void Step(Box2D.XNA.TestBed.Framework.Settings settings)
        {
            bool advanceRay = settings.pause == 0 || settings.singleStep != 0;

            base.Step(settings);
            _debugDraw.DrawString(5, _textLine, "Press 1-5 to drop stuff");
            _textLine += 15;

            float   L      = 25.0f;
            Vector2 point1 = new Vector2(0.0f, 10.0f);
            Vector2 d      = new Vector2(L * (float)Math.Cos(_angle), -L * Math.Abs((float)Math.Sin(_angle)));
            Vector2 point2 = point1 + d;

            _world.RayCast((fixture, point, normal, fraction) =>
            {
                _fixture = fixture;
                _point   = point;
                _normal  = normal;

                return(fraction);
            }, point1, point2);

            if (_fixture != null)
            {
                _debugDraw.DrawPoint(_point, .5f, new Color(0.4f, 0.9f, 0.4f));

                _debugDraw.DrawSegment(point1, _point, new Color(0.8f, 0.8f, 0.8f));

                Vector2 head = _point + 0.5f * _normal;
                _debugDraw.DrawSegment(_point, head, new Color(0.9f, 0.9f, 0.4f));
            }
            else
            {
                _debugDraw.DrawSegment(point1, point2, new Color(0.8f, 0.8f, 0.8f));
            }

            if (advanceRay)
            {
                _angle += 0.25f * (float)Math.PI / 180.0f;
            }
        }
Пример #3
0
 public override void  Step(Box2D.XNA.TestBed.Framework.Settings settings)
 {
     base.Step(settings);
     _debugDraw.DrawString(5, _textLine, "This tests various character collision shapes");
     _textLine += 15;
 }