public PhysicsCollision(BasePhysicsComponent b1, BasePhysicsComponent b2, Vector2f normal, float penetration) { m_body1 = b1; m_body2 = b2; m_normal = normal; m_penetration = penetration; }
internal void RegisterPhysicsComponent(BasePhysicsComponent component) { if (!m_physicBodyComponents.Contains(component)) { m_physicBodyComponents.Add(component); } }
internal List <PhysicsCollision> RunBroadphase(List <BasePhysicsComponent> components) { if (!m_runBroadphaseAlgorithm) { // If the user doesn't want to run the broadphase, return null. The DetectCollisions method will know what to do. return(null); } List <PhysicsCollision> collisions = new List <PhysicsCollision>(); // Temporary code that simulates a broadphase algorithm. In this case, for (int i = 0; i < m_physicBodyComponents.Count; i++) { BasePhysicsComponent comp = m_physicBodyComponents[i]; for (int j = 0; j < m_physicBodyComponents.Count; j++) { if (m_physicBodyComponents[j].Equals(comp)) { continue; } // Run broadphase calculations here collisions.Add(new PhysicsCollision(comp, m_physicBodyComponents[j], default, 0.0f));
internal void DeregisterPhysicsComponent(BasePhysicsComponent component) { m_physicBodyComponents.Remove(component); }