Beispiel #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);
   }
 }
Beispiel #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;
 }
Beispiel #3
0
 public void clearBodies() {
   broadPhase.clear();
   if (broadPhase != rayBroadPhase) {
     rayBroadPhase.clear();
   }
 }