From 3ab4d5d8fe197e9af9840d93d8d4319cdfb6e3a9 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 13 Sep 2016 18:13:24 +0200 Subject: [PATCH] Cleanup body association for ray polys we discard. Add missed call to update_shapes --- tabakrolletjie/rays.py | 2 ++ tabakrolletjie/scenes/day.py | 1 + 2 files changed, 3 insertions(+) diff --git a/tabakrolletjie/rays.py b/tabakrolletjie/rays.py index ac51802..9db09a2 100644 --- a/tabakrolletjie/rays.py +++ b/tabakrolletjie/rays.py @@ -109,6 +109,8 @@ class RayPolyManager(object): def update_shapes(self): if self._old_poly_cache: self._space.remove(*self._old_poly_cache) + for poly in self._old_poly_cache: + poly.body = None new_polys = self._old_poly_cache = self.polys() self._space.add(*new_polys) diff --git a/tabakrolletjie/scenes/day.py b/tabakrolletjie/scenes/day.py index cbe0460..4176e36 100644 --- a/tabakrolletjie/scenes/day.py +++ b/tabakrolletjie/scenes/day.py @@ -206,6 +206,7 @@ class DayScene(BaseScene): angle = math.atan2(distance[1], distance[0]) # Set light angle to this position self._dragging.ray_manager.direction = math.degrees(angle) + self._dragging.ray_manager.update_shapes() # Hackily update gamestate with new angle for light_cfg in gamestate.station["lights"]: light_pos = pymunk.Vec2d(light_cfg["position"]) -- 2.34.1