Keep number of vertices low during ray tracing.
authorSimon Cross <hodgestar@gmail.com>
Sun, 4 Sep 2016 21:19:24 +0000 (23:19 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sun, 4 Sep 2016 21:19:24 +0000 (23:19 +0200)
tabakrolletjie/lights.py

index ece9c4ef950ae698817bd6d2a549dbfbb85497f8..ecb6cedd44391a5e2e293b01b4d3bd37f67f1087 100644 (file)
@@ -50,6 +50,8 @@ def calculate_ray_polys(space, body, position):
                 new_poly = pymunk.Poly(body, vertices[:-1])
                 vertices = [position, vertices[-1]]
                 ray_polys.append(new_poly)
+            else:
+                vertices = trial_poly.get_vertices() + [point]
     if len(vertices) > 2:
         ray_polys.append(pymunk.Poly(body, vertices))
     end_time = time.time()