Skip to content

Overlapping MObjects on ThreeDScene #2295

@ANearchou

Description

@ANearchou

How can I hide mobjects to the back when overlapping with other in 3D Scenes? Unless I'm doing something wrong, self.add_foreground_mobjects, self.bring_to_back and self.bring_to_front doesn't work.

How to reproduce the issue

class test(ThreeDScene):
    def construct(self):

        axes = ThreeDAxes()

        cir = Circle(radius = 0.5).move_to([-5,-5,0]).set_color("#FEFFAF")

        sphere = ParametricSurface(
            lambda u, v: np.array([
                2*np.cos(u)*np.cos(v),
                2*np.cos(u)*np.sin(v),
                2*np.sin(u)
            ]), v_min=0, v_max=2*PI, u_min=-PI/2, u_max=PI/2, fill_opacity = 1.0,
            checkerboard_colors=[RED_D], resolution=(6, 16), stroke_color = RED_D
        )

        self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)
        self.bring_to_back(cir)
        self.bring_to_front(sphere)
        self.add_foreground_mobjects(sphere)
        self.add(axes)
        self.add(cir)
        self.add(sphere)

        self.wait(1)

Output:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue:bugSomething isn't working... For use in issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions