/// <summary> /// Checks and resolves all Pairs /// </summary> /// <param name="pairs"></param> /// <param name="nPhase"></param> public void UpdatePhysics(List <Pair> pairs, NarrowPhase nPhase) { for (int i = 0; i < pairs.Count; i++) { if (nPhase.CheckCollision(pairs[i])) { nPhase.ResolveCollision(pairs[i]); nPhase.PositionalCorrection(pairs[i], 0.4f, 0.1f); } } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here bPhase = new BroadPhase(); nPhase = new NarrowPhase(this); scene = new Scene(new Vector2(0, 9.8f), dt); inputForce = 10f; rand = new Random(); pairs = new List <Pair>(); //GraphicsDevice.Viewport = new Viewport(100, 100, 1600, 800); base.Initialize(); }