ManimCommunity / ManimCommunity/manim

`Variable` class does not get fixed in the in `ThreeDScene` with `add_fixed_in_frame_mobjects()`

Open
#2,942 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

## Description of bug / unexpected behavior
`self.add_fixed_in_frame_mobjects(x)` should fix the object `x` on the 2D screen while one works in a 3D Scene. In fact, it works when `x` is a `Text` class, as shown in the [examples](https://docs.manim.community/en/stable/examples.html#fixedinframemobjecttest). But when `x` is a `Variable` class, its position changes when we perform the animation `self.play(x.tracker.animate.set_value())`

## Expected behavior
`x` should remain on its place as we change the tracker value.

## How to reproduce the issue

Code for reproducing the problem

```py
from manim import *

class FixedInFrameMObjectTest(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
self.set_camera_orientation(phi=75 * DEGREES, theta=-45 * DEGREES)
self.play(Create(axes))
self.wait()
text3d = Variable(0.3, MathTex("x"))
text3d.to_corner(UL)
self.add_fixed_in_frame_mobjects(text3d)
self.play(Write(text3d))
self.wait()
self.play(text3d.tracker.animate.set_value(1))
self.wait()
```

## Additional media files

Images/GIFs

![FixedInFrameMObjectTest_ManimCE_v0 16 0 post0](https://user-images.githubusercontent.com/22801918/188655988-f41d45d4-2f21-4253-9b0b-66466b28ccf8.gif)

## Logs
Terminal output

```
❯ manim -ql -p test.py
Manim Community v0.16.0.post0

[09/06/22 12:21:48] INFO Animation 0 : Using cached data (hash : cairo_renderer.py:75
166007114_155735041_223132457)
[09/06/22 12:21:49] INFO Animation 1 : Using cached data (hash : cairo_renderer.py:75
723241031_3315967912_2417228262)
[09/06/22 12:21:50] INFO Animation 2 : Using cached data (hash : cairo_renderer.py:75
723241031_1815128715_1682129457)
[09/06/22 12:21:51] INFO Animation 3 : Using cached data (hash : cairo_renderer.py:75
723241031_3315967912_3582625705)
[09/06/22 12:21:52] INFO Animation 4 : Using cached data (hash : cairo_renderer.py:75
723241031_3076078580_3009176059)
[09/06/22 12:21:53] INFO Animation 5 : Using cached data (hash : cairo_renderer.py:75
723241031_3315967912_4108828480)
INFO Combining to Movie file. scene_file_writer.py:607
[09/06/22 12:21:54] INFO scene_file_writer.py:728
File ready at
'/home/tapyu/git/courses/phd_nonlinear_opt/
Exercises/media/videos/test/480p15/FixedInF
rameMObjectTest_ManimCE_v0.16.0.post0.gif'

INFO Rendered FixedInFrameMObjectTest scene.py:240
Played 6 animations
INFO Previewed File at: file_ops.py:224
'/home/tapyu/git/courses/phd_nonlinear_opt/Exercises
/media/videos/test/480p15/FixedInFrameMObjectTest_Ma
nimCE_v0.16.0.post0.gif'
```

## System specifications

System Details

```
OS: Ubuntu 22.04 jammy
Kernel: x86_64 Linux 5.15.0-47-generic
Uptime: 1d 1h 37m
Packages: 2157
Shell: zsh 5.8.1
Resolution: 1366x768
DE: GNOME 41.7
WM: Mutter
WM Theme:
GTK Theme: Yaru-dark [GTK2/3]
Icon Theme: Yaru
Font: Ubuntu 11
Disk: 71G / 469G (16%)
CPU: Intel Core i5-8250U @ 8x 3.4GHz [49.0°C]
GPU: Intel Corporation UHD Graphics 620 (rev 07)
RAM: 1682MiB / 2288MiB
```

LaTeX details

```
❯ tex --version
TeX 3.141592653 (TeX Live 2022/dev/Debian)
```

FFMPEG

```
❯ ffmpeg -version
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
```

## Additional comments
I haven't used `Manim` for a while (2 or 3 years), and the syntax change considerably. So my code may have some errors.

Contributor guide

Open the contributing guide

Research direction

Start by running the provided FixedInFrameMObjectTest reproduction with Variable, ThreeDScene, add_fixed_in_frame_mobjects(), and tracker.animate.set_value(). Read the Variable and ThreeDScene behavior involved in fixed-in-frame objects; done means the Variable remains in the same 2D-screen position while its tracker value changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.