# Camera Troubles in Mathematica

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)

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,
PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}}],(*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,
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}]


• Very nice, thanks. But I don't suppose you can tell what I'm misunderstanding with my approach? Commented Jun 28, 2012 at 20:07
• @smackcrane The first element in the Show[] list determines the PlotRange ... Commented Jun 28, 2012 at 20:11
• I was under the impression that PlotRange->All fixed that problem Commented Jun 28, 2012 at 20:20
• Why is your animation all in pink like an error box? Commented Jun 29, 2012 at 6:51
• @smackcrane you can set the PlotRange as an option of Show but All is variable. If you use PlotRange -> {{-2, 2}, {-2, 2}, {-2, 2}} it will work. Commented Jun 29, 2012 at 6:55