示例#1
0
文件: Space.java 项目: psalaets/spash
 private void add(Body body) {
   if (body == null) throw new IllegalArgumentException("bodies cannot contain null");
   broadPhase.add(body);
   if (broadPhase != rayBroadPhase) {
     rayBroadPhase.add(body);
   }
 }
示例#2
0
文件: Space.java 项目: psalaets/spash
 /**
  * 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;
 }
示例#3
0
文件: Space.java 项目: psalaets/spash
 public void clearBodies() {
   broadPhase.clear();
   if (broadPhase != rayBroadPhase) {
     rayBroadPhase.clear();
   }
 }