Fix check for segment query result.
authorSimon Cross <hodgestar@gmail.com>
Thu, 8 Sep 2016 22:23:55 +0000 (00:23 +0200)
committerSimon Cross <hodgestar@gmail.com>
Thu, 8 Sep 2016 22:23:55 +0000 (00:23 +0200)
tabakrolletjie/rays.py

index cac7c3bf90833c890d1e6049569104584a4a9709..f4c5ed16fcc69f1500aab6f6be3e0eeadb77e2a6 100644 (file)
@@ -135,19 +135,19 @@ class RayPoly(object):
             return trial  # no limits
 
         start_info = trial.segment_query(
-            self.position + 0.1 * start, self.position + 1250 * start, 1)
+            self.position + 0.1 * start, self.position + 1250 * start, 0)
         end_info = trial.segment_query(
-            self.position + 0.1 * end, self.position + 1250 * end, 1)
+            self.position + 0.1 * end, self.position + 1250 * end, 0)
 
         vertices = self.vertices[:]
-        if start_info:
-            vertices.append(start_info.point)
-        if end_info:
-            vertices.append(end_info.point)
         vertices = [
             v for v in vertices
             if self._between((v - self.position).angle, start.angle, end.angle)
         ]
+        if start_info.shape is not None:
+            vertices.append(start_info.point)
+        if end_info.shape is not None:
+            vertices.append(end_info.point)
         vertices.append(self.position)
 
         poly = pymunk.Poly(None, vertices)