예제 #1
0
        protected override void PreLateUpdate()
        {
            var callback = new PolyShapesCallback(Drawer)
            {
                Circle = { Radius = 2.0f }
            };

            callback.Circle.Position.Set(0.0f, 1.1f);
            callback.Circle.ComputeAABB(out var aabb, callback.Transform, 0);
            callback.Transform.SetIdentity();

            World.QueryAABB(callback.Callback, aabb);

            var color = Color.FromArgb(102, 178, 204);

            Drawer.DrawCircle(callback.Circle.Position, callback.Circle.Radius, color);
        }
예제 #2
0
        /// <inheritdoc />
        public override void OnRender()
        {
            DrawString("Press 1-5 to drop stuff");
            DrawString("Press 'a' to (de)activate some bodies");
            DrawString("Press 'd' to destroy a body");

            var k = -1;

            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                k = 0;
            }

            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                k = 1;
            }

            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                k = 2;
            }

            if (Input.GetKeyDown(KeyCode.Alpha4))
            {
                k = 3;
            }

            if (Input.GetKeyDown(KeyCode.Alpha5))
            {
                k = 4;
            }

            if (k > -1)
            {
                Create(k);
            }

            if (Input.GetKeyDown(KeyCode.A))
            {
                for (var i = 0; i < MaxBodies; i += 2)
                {
                    if (_bodies[i] != null)
                    {
                        var active = _bodies[i].IsActive;
                        _bodies[i].IsActive = !active;
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.D))
            {
                DestroyBody();
            }

            var callback = new PolyShapesCallback(Drawer)
            {
                Circle = { Radius = 2.0f }
            };

            callback.Circle.Position.Set(0.0f, 1.1f);
            callback.Circle.ComputeAABB(out var aabb, callback.Transform, 0);
            callback.Transform.SetIdentity();

            World.QueryAABB(callback, aabb);

            var color = Color.FromArgb(102, 178, 204);

            Drawer.DrawCircle(callback.Circle.Position, callback.Circle.Radius, color);
        }