It seems like add_fixed_orientation_mobjects does not work with MathTex (or maybe I'm using it badly?) as the object is rotated.
The text should not be rotated.
Code for reproducing the problem
from manim import *
class Tests(ThreeDScene):
def construct(self):
sphere = Surface(
lambda u, v: R * np.array([
np.sin(v) * np.cos(u),
np.cos(v),
np.sin(v) * np.sin(u),
]),
u_range=[0, TAU], v_range=[0, PI],
resolution=(36, 18),
fill_color=BLUE_D, fill_opacity=0.0,
stroke_color=BLUE_E, stroke_width=0.4, stroke_opacity=0.6,
)
labels = MathTex(r"|0\rangle")
self.add_fixed_orientation_mobjects(labels)
self.play(Create(sphere, lag_ratio=0.01))
self.play(sphere.animate.set_fill(BLUE_D, opacity=0.30))
# Move "up" a bit:
self.move_camera(
phi=-20 * DEGREES,
added_anims = [
],
run_time=3.0, rate_func=smooth)
## Rotate around Y axis (move_camera is too hard to use if not around z axis)
self.play(
Rotate(
VGroup(m for m in self.mobjects if isinstance(m, (VMobject, Surface))),
PI/4,
[0,1,0],
about_point=ORIGIN,
),
run_time=3.0,
rate_func=smooth
)
self.wait(0.3)
class Tests(ThreeDScene):
def construct(self):
sphere = Surface(
lambda u, v: R * np.array([
np.sin(v) * np.cos(u),
np.cos(v),
np.sin(v) * np.sin(u),
]),
u_range=[0, TAU], v_range=[0, PI],
resolution=(36, 18),
fill_color=BLUE_D, fill_opacity=0.0,
stroke_color=BLUE_E, stroke_width=0.4, stroke_opacity=0.6,
)
labelp = Circle(0).move_to(label_pos(0, 2))
labels = always_redraw(lambda: MathTex(r"|0\rangle").move_to(labelp))
self.add(labels)
self.add(labelp)
self.play(Create(sphere, lag_ratio=0.01))
self.play(sphere.animate.set_fill(BLUE_D, opacity=0.30))
# Move "up" a bit:
self.move_camera(
phi=-20 * DEGREES,
added_anims = [
],
run_time=3.0, rate_func=smooth)
## Rotate around Y axis (move_camera is too hard to use if not around z axis)
self.play(
Rotate(
VGroup(m for m in self.mobjects if isinstance(m, (VMobject, Surface)) and m != labels),
PI/4,
[0,1,0],
about_point=ORIGIN,
),
run_time=3.0,
rate_func=smooth
)
self.wait(0.3)
Description of bug / unexpected behavior
It seems like add_fixed_orientation_mobjects does not work with MathTex (or maybe I'm using it badly?) as the object is rotated.
Expected behavior
The text should not be rotated.
How to reproduce the issue
Code for reproducing the problem
Additional media files
Images/GIFs
Tests.mp4
Logs
Terminal output
System specifications
System Details
python/py/python3 --version): 3.13.19pip list):LaTeX details
Additional comments
EDIT My guess is that there is a clash with the rotation that wants to be applied twice… So far my trick is not to use
add_fixed_orientation_mobject, instead I use a dummy point to track the location andalways_redrawto place the point at the coordinate of the dummy point with the rotation I want, like this: