From 5782c13813fcb9ff0829fd511408a388eb780433 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 30 Aug 2018 14:23:48 -0700 Subject: [PATCH] Back to old way of z-indexing --- camera/three_d_camera.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/camera/three_d_camera.py b/camera/three_d_camera.py index a4f4fe3d..4957c6c2 100644 --- a/camera/three_d_camera.py +++ b/camera/three_d_camera.py @@ -102,17 +102,12 @@ class ThreeDCamera(Camera): rot_matrix = self.get_rotation_matrix() def z_key(mob): - if not isinstance(mob, VMobject): - return np.inf - if not mob.shade_in_3d: + if not (hasattr(mob, "shade_in_3d") and mob.shade_in_3d): return np.inf # Assign a number to a three dimensional mobjects # based on how close it is to the camera - points = mob.points - if len(points) == 0: - return 0 return np.dot( - center_of_mass(points), + mob.get_center(), rot_matrix.T )[2] return sorted(mobjects, key=z_key)