public PhysicsStateManager(Physics physics)
 {
     this.curr_time = 0f;
     this.frequency = 1/15f;
     this.physics = physics;
     this.bodies = new Dictionary<Body, PhysicsHistory>();
 }
示例#2
0
        public void Initialize()
        {
            device = this.graphics.GraphicsDevice;

            camera = new Camera(0.1f, 100, 1.2f, WIDTH / (float)HEIGHT);
            camera.position = new Vector3(0, 0, 0);
            camera.target = new Vector3(0, 0, 0);

            trianglebatch = new TriangleBatch(device);
            linebatch = new LineBatch(device);
            spritebatch = new SpriteBatch(device);
            basiceffect = new BasicEffect(device);
            basiceffect.VertexColorEnabled = true;

            debugFont = content.Load<SpriteFont>("fonts/debug");

            physics = new Physics();
            physicsRenderer = new PhysicsRenderer(device);
            physicsRenderer.SetPhysics(physics);
            physicsRenderer.SetCamera(camera);
            physicsStateManager = new PhysicsStateManager(physics);
            physicsStateManager.SetRecordingFrequency(1 / 15f);

            AddPhysicsBodies();
        }
 public void SetPhysics(Physics physics)
 {
     this.physics = physics;
 }