Exemple #1
0
        public override void Step(Framework.Settings settings)
        {
            _rayActor = null;
            for (int i = 0; i < e_actorCount; ++i)
            {
                _actors[i].fraction = 1.0f;
                _actors[i].overlap  = false;
            }

            if (_automated == true)
            {
                int actionCount = Math.Max(1, e_actorCount >> 2);

                for (int i = 0; i < actionCount; ++i)
                {
                    Action();
                }
            }

            Query();
            RayCast();

            for (int i = 0; i < e_actorCount; ++i)
            {
                Actor actor = _actors[i];
                if (actor.proxyId == -1)
                {
                    continue;
                }

                Color ca = new ColorR(0.9, 0.9, 0.9);
                if (actor == _rayActor && actor.overlap)
                {
                    ca = new ColorR(0.9, 0.6, 0.6);
                }
                else if (actor == _rayActor)
                {
                    ca = new ColorR(0.6, 0.9, 0.6);
                }
                else if (actor.overlap)
                {
                    ca = new ColorR(0.6, 0.6, 0.9);
                }

                _debugDraw.DrawAABB(ref actor.aabb, ca);
            }

            Color c = new ColorR(0.7, 0.7, 0.7);

            _debugDraw.DrawAABB(ref _queryAABB, c);

            _debugDraw.DrawSegment(_rayCastInput.p1, _rayCastInput.p2, c);

            Color c1 = new ColorR(0.2, 0.9, 0.2);
            Color c2 = new ColorR(0.9, 0.2, 0.2);

            _debugDraw.DrawPoint(_rayCastInput.p1, 6.0, c1);
            _debugDraw.DrawPoint(_rayCastInput.p2, 6.0, c2);

            if (_rayActor != null)
            {
                Color   cr = new ColorR(0.2, 0.2, 0.9);
                Vector2 p  = _rayCastInput.p1 + _rayActor.fraction * (_rayCastInput.p2 - _rayCastInput.p1);
                _debugDraw.DrawPoint(p, 6.0, cr);
            }

            {
                int height = _tree.ComputeHeight();
                _debugDraw.DrawString(5, _textLine, "dynamic tree Height = %d", height);
                _textLine += 15;
            }

            ++_stepCount;
        }