让我们画一颗行星及其卫星,相机从指向地球的视角跟随月球。例如:
a = {-3.5, 3.5};
Animate[
Show[
Graphics3D[
Sphere[3 {Cos@t, Sin@t, 0}, .5],
ViewPoint -> 3.5 {Cos@t, Sin@t, 0},
SphericalRegion -> True,
PlotRange -> {a, a, a}, Axes -> False, Boxed -> False],
myEarth],
{t, 0, 2 Pi}]
其中 myEarth 是另一个 3D Graphics(供参考)。
静态垂直视图:
a = {-3.5, 3.5};
Animate[
Show[
Graphics3D[
Sphere[3 {Cos@t, Sin@t, 0}, .5],
ViewPoint -> 3.5 {0,0,1},
SphericalRegion -> True,
PlotRange -> {a, a, a}, Axes -> False, Boxed -> False],
myEarth],
{t, 0, 2 Pi}]
诀窍是SphericalRegion -> 真,没有它,图像视角会在帧之间“移动”。
Edit
有两个静态对象: