I'm trying to animate a torus being cut by a plane, so that as the plane enters the torus the part in front of the plane disappears (the idea is to show the cross section). That much I can do, but I can't seem to get the camera to behave. I'd like everything to stay the same size and position, but despite setting ViewVector
, ViewAngle
, and ViewVertical
the scene becomes smaller as the animation progresses. Note that I chose the settings pretty arbitrarily. I am baffled as to why the camera view changes with these three options fixed.
Here is the code (I produce the frames in a table, and then export them for the animation).
Table[Show[
ContourPlot3D[(1 - Sqrt[x^2 + (y + 1/2)^2])^2 + z^2 - 1/4 ==
0, {x, -2, 2}, {y, -2, 2 - 2 t}, {z, -2, 2}, Mesh -> False], (*The torus*)
ContourPlot3D[y == 2 - 2 t, {x, -2, 2}, {y, -2, 2}, {z, -2, 2},
Mesh -> False, ContourStyle -> {White, Opacity[.5]}], (*The plane*)
Axes -> False, Boxed -> True, PlotRange -> All,
ViewVector -> {{5 Sqrt[6], 10 Sqrt[6], 5 Sqrt[6]}, {0, 0, 0}},
ViewAngle -> 3 Pi/50, ViewVertical -> {0, 0, 1}], {t, 0, 1, .5}]
And here is the result.
As you can see, the camera zooms out and seems to rotate slightly. Any idea how to fix this?
(Edited to add PlotRange -> All
)