Ejemplo n.º 1
0
 private void add(Body body) {
   if (body == null) throw new IllegalArgumentException("bodies cannot contain null");
   broadPhase.add(body);
   if (broadPhase != rayBroadPhase) {
     rayBroadPhase.add(body);
   }
 }
Ejemplo n.º 2
0
 /**
  * Returns all contacts made by a ray.
  *
  * @param ray
  * @return Ray contacts, never null
  */
 public List<RayContact> allReached(Ray ray) {
   List<RayContact> contacts = new ArrayList<RayContact>();
   for (Body body : rayBroadPhase.potentialBodies(ray)) {
     RayContact contact = isReached(body, ray);
     if (contact != null) {
       contacts.add(contact);
     }
   }
   sort(contacts, byAscendingDistanceFromRayStart());
   return contacts;
 }
Ejemplo n.º 3
0
 public void clearBodies() {
   broadPhase.clear();
   if (broadPhase != rayBroadPhase) {
     rayBroadPhase.clear();
   }
 }