From: Neil Date: Tue, 13 Sep 2016 16:13:24 +0000 (+0200) Subject: Cleanup body association for ray polys we discard. Add missed call to update_shapes X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=3ab4d5d8fe197e9af9840d93d8d4319cdfb6e3a9;p=tabakrolletjie.git Cleanup body association for ray polys we discard. Add missed call to update_shapes --- 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"])