mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 22:47:45 +00:00
Back to old way of z-indexing
This commit is contained in:
parent
8a1f121207
commit
5782c13813
1 changed files with 2 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue