Ejemplo n.º 1
0
        private void ConstructPhysicsSimulator(Vector2 gravity)
        {
            geomList = new GeomList();
            geomAddList = new List<Geom>();
            geomRemoveList = new List<Geom>();

            bodyList = new BodyList();
            bodyAddList = new List<Body>();
            bodyRemoveList = new List<Body>();

            controllerList = new ControllerList();
            controllerAddList = new List<Controller>();
            controllerRemoveList = new List<Controller>();

            jointList = new JointList();
            jointAddList = new List<Joint>();
            jointRemoveList = new List<Joint>();

            springList = new SpringList();
            springAddList = new List<Spring>();
            springRemoveList = new List<Spring>();

            _broadPhaseCollider = new SelectiveSweepCollider(this);

            arbiterList = new ArbiterList();
            _gravity = gravity;

            arbiterPool = new Pool<Arbiter>(_arbiterPoolSize);

            #region Added by Daniel Pramel 08/17/08

            _inactivityController = new InactivityController(this);

            _scaling = new Scaling(0.001f, 0.01f);

            #endregion
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150));

            // This distance has to be big enough to make sure all objects are reactivated
            // before they could collide with an currently active object
            // our biggest object is 25*25 -> 120 would be big enough
            InactivityController controller = new InactivityController(PhysicsSimulator);
            controller.ActivationDistance = 120;

            // Deactivate the object after 2 seconds of idle time
            controller.MaxIdleTime = 2000;
            controller.Enabled = true;

            PhysicsSimulator.Add(controller);
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }