예제 #1
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }
예제 #2
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 0));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }
예제 #3
0
        public override void Initialize()
        {
            PhysicsSimulator            = new PhysicsSimulator(new Vector2(0, 50));
            PhysicsSimulator.BiasFactor = .3f;
            //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair.
            PhysicsSimulator.MaxContactsToDetect = 2;

            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableEdgeView = false;

            // POINT OF INTEREST
            // Create a physics processor based on the physics processor
            _physicsProcessor = new PhysicsProcessor(PhysicsSimulator);
            // POINT OF INTEREST
            // Create the physics thread with the StartThinking function as the entry point.
            // The StartThinking is going to be the main function of the physics thread.
            _physicsThread = new Thread(_physicsProcessor.StartThinking);
            // POINT OF INTEREST
            // Name the thread for debugging purposes
            _physicsThread.Name = "PhysicsThread";
            // POINT OF INTEREST
            // And now start the thread
            _physicsThread.Start();

            base.Initialize();
        }
예제 #4
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 100));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableGridView = false;

            base.Initialize();
        }
예제 #5
0
 public PhysicsComponent(Game game, PhysicsSimulator physicsSimulator)
     : base(game)
 {
     physicsSimulatorView = new PhysicsSimulatorView(physicsSimulator);
     this.PhysicsSimulator = physicsSimulator;
     this.Debug = false;
     Game.Services.AddService(typeof(IPhysicsSimulatorService), this);
 }
예제 #6
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 0));
            PhysicsSimulator.MaxContactsToDetect = 2;
            //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair.
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }
예제 #7
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150));
            PhysicsSimulator.MaxContactsToDetect  = 5;
            PhysicsSimulator.MaxContactsToResolve = 2;
            PhysicsSimulator.Iterations           = 10;
            PhysicsSimulator.BiasFactor           = .4f;
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }
예제 #8
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 100));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            PhysicsSimulatorView.EnableEdgeView           = true;
            PhysicsSimulatorView.EnableCoordinateAxisView = true;
            PhysicsSimulatorView.EnableAABBView           = false;

            base.Initialize();
        }
예제 #9
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150));
            PhysicsSimulator.MaxContactsToDetect = 5;
            PhysicsSimulator.MaxContactsToResolve = 2;
            PhysicsSimulator.Iterations = 10;
            PhysicsSimulator.BiasFactor = .4f;
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }
예제 #10
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 150));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            if (_usePool)
            {
                LoadPool();
            }

            base.Initialize();
        }
예제 #11
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 50));
            //PhysicsSimulator.NarrowPhaseCollider = new SAT(PhysicsSimulator);
            PhysicsSimulator.BiasFactor = .2f;
            //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair.
            PhysicsSimulator.MaxContactsToDetect = 2;

            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableEdgeView = false;

            base.Initialize();
        }
예제 #12
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 200));
            PhysicsSimulator.MaxContactsToDetect = 2;
            //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair.
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableEdgeView           = false;
            PhysicsSimulatorView.EnableVerticeView        = false;
            PhysicsSimulatorView.EnableAABBView           = true;
            PhysicsSimulatorView.EnableCoordinateAxisView = true;

            base.Initialize();
        }
예제 #13
0
        public Physics(Vector2 newGravity)
        {
            if (Instance != null) throw new Exception("Physics engine instance doubled!");
            Physics.Instance = this;

            this.setGravity(newGravity);
            BiasFactor = 0.01f;
            //AllowedPenetration = 0.01f;
            this.Iterations = 50;
            this.MaxContactsToResolve = 3;
            physicsSimulatorView = new DemoBaseXNA.PhysicsSimulatorView(this);
            // physicsSimulatorView.EnableEdgeView = false;
            physicsSimulatorView.LoadContent(Game1.Instance.GraphicsDevice, Game1.Instance.Content);
        }
예제 #14
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 250));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            _cameraMatrix     = Matrix.Identity;
            _projectionMatrix = Matrix.CreateOrthographicOffCenter(0, 1024, 768, 0, -100, 100);
            _worldMatrix      = Matrix.Identity;

            _waterModel = new WaterModel();
            _waterModel.Initialize(PhysicsSimulator);
            _waterModel.WaveController.Enabled = true;  // if false waves will not be created

            base.Initialize();
        }
예제 #15
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 100));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulator.MaxContactsToDetect  = 6;
            PhysicsSimulator.MaxContactsToResolve = 3;
            PhysicsSimulator.BroadPhaseCollider   = new BruteForceCollider(PhysicsSimulator);
            PhysicsSimulator.Iterations           = 20;

            PhysicsSimulatorView.EnableContactView = false;
            PhysicsSimulatorView.EnableEdgeView    = true;
            PhysicsSimulatorView.EnableAABBView    = false;
            PhysicsSimulatorView.EnableVerticeView = false;

            base.Initialize();
        }
예제 #16
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100));

            // Use the SAT narrow phase collider
            PhysicsSimulator.NarrowPhaseCollider = NarrowPhaseCollider.SAT;

            // setup our debug view
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableEdgeView = true;
            PhysicsSimulatorView.EnableAABBView = false;

            // initalize a list of splats
            splats = new List<Splat>();

            base.Initialize();
        }
예제 #17
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100));

            // Use the SAT narrow phase collider
            PhysicsSimulator.NarrowPhaseCollider = new SAT(PhysicsSimulator);

            // setup our debug view
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableEdgeView = true;
            PhysicsSimulatorView.EnableAABBView = false;

            // initalize a list of splats
            splats = new List <Splat>();

            base.Initialize();
        }
예제 #18
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();
        }
예제 #19
0
        public override void Initialize()
        {
            PhysicsSimulator     = new PhysicsSimulator(new Vector2(0, 150));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableVerticeView          = true;
            PhysicsSimulatorView.EnableEdgeView             = false;
            PhysicsSimulatorView.EnableContactView          = false;
            PhysicsSimulatorView.EnableAABBView             = false;
            PhysicsSimulatorView.EnablePerformancePanelView = false;
            PhysicsSimulatorView.EnableCoordinateAxisView   = false;
            PhysicsSimulatorView.EdgeColor         = Color.Red;
            PhysicsSimulatorView.EdgeLineThickness = 2;
            PhysicsSimulatorView.VerticeColor      = Color.CornflowerBlue;
            PhysicsSimulatorView.VerticeRadius     = 5;
            DebugViewEnabled = true;

            _messages             = new List <TextMessage>();
            _simulatedPolyBrushes = new List <PolygonBrush>();
            _simulatedPolyBodies  = new List <Body>();

            base.Initialize();
        }
예제 #20
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 0));
            PhysicsSimulator.MaxContactsToDetect = 2;
            //for stacked objects, simultaneous collision are the bottlenecks so limit them to 2 per geometric pair.
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            base.Initialize();
        }
예제 #21
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);
            PhysicsSimulatorView.EnableVerticeView = true;
            PhysicsSimulatorView.EnableEdgeView = false;
            PhysicsSimulatorView.EnableContactView = false;
            PhysicsSimulatorView.EnableAABBView = false;
            PhysicsSimulatorView.EnablePerformancePanelView = false;
            PhysicsSimulatorView.EnableCoordinateAxisView = false;
            PhysicsSimulatorView.EdgeColor = Color.Red;
            PhysicsSimulatorView.EdgeLineThickness = 2;
            PhysicsSimulatorView.VerticeColor = Color.CornflowerBlue;
            PhysicsSimulatorView.VerticeRadius = 5;
            DebugViewEnabled = true;

            _messages = new List<TextMessage>();
            _simulatedPolyBrushes = new List<PolygonBrush>();
            _simulatedPolyBodies = new List<Body>();

            base.Initialize();
        }
예제 #22
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            if (_usePool)
                LoadPool();

            base.Initialize();
        }
예제 #23
0
        public override void Initialize()
        {
            PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 100));
            PhysicsSimulatorView = new PhysicsSimulatorView(PhysicsSimulator);

            PhysicsSimulatorView.EnableEdgeView = true;
            PhysicsSimulatorView.EnableCoordinateAxisView = true;
            PhysicsSimulatorView.EnableAABBView = false;

            base.Initialize();
        }
예제 #24
0
 protected GameScreen()
 {
     _physicsSimulator     = new PhysicsSimulator(new Vector2(0, 0));
     _physicsSimulatorView = new PhysicsSimulatorView(_physicsSimulator);
 }
예제 #25
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();
        }