不能在WPF Viewport3D派生类中动画相机

本文关键字:动画 相机 派生 WPF Viewport3D 不能 | 更新日期: 2023-09-27 18:01:30

我想扩展Viewport3D类,以包括控制摄像机的简单内置方法,但是一旦我试图在派生类中动画摄像机时,由于摄像机被'冻结',我得到InvalidOperationException:

System.InvalidOperationException occurred
  Message=Cannot animate the 'LookDirection' property on 'System.Windows.Media.Media3D.PerspectiveCamera' because the object is sealed or frozen.
  Source=PresentationCore
  StackTrace:
       at System.Windows.Media.Animation.Animatable.BeginAnimation(DependencyProperty dp, AnimationTimeline animation, HandoffBehavior handoffBehavior)
       at Viewport3DwithControls.ControllableViewport3D.ControllableViewport3D_Loaded(Object sender, RoutedEventArgs e) in FrozenCameraExample'Viewport3DwithControls'ControllableViewport3D.cs:line 25

我已经尝试创建一个新的相机,并将其分配给Viewport的相机参数,但新的相机不会改变相机的视图在新的视口。它停留在设计时的位置。

我以前已经能够使用"香草"Viewport3D动画相机,所以它似乎与创建派生类有关,但我不知道为什么它会有任何不同的行为。

下面是抛出错误的示例代码片段:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Media3D;
using System.Windows.Media.Animation;
namespace Viewport3DwithControls
{
    public partial class ControllableViewport3D : Viewport3D
    {
        private PerspectiveCamera _camera;
        public ControllableViewport3D()
            : base()
        {
            if (this.Camera is PerspectiveCamera)
                _camera = (PerspectiveCamera)this.Camera;
            Loaded += new RoutedEventHandler(ControllableViewport3D_Loaded);
        }
        private void ControllableViewport3D_Loaded(object sender, RoutedEventArgs e)
        {
            Vector3DAnimation cameraLookAnim = new Vector3DAnimation(new Vector3D(0, -1, 0), new Duration(TimeSpan.FromSeconds(5)));
            _camera.BeginAnimation(PerspectiveCamera.LookDirectionProperty, cameraLookAnim);
        }
    }
}

下面是我用来测试上述新的Viewport3D对象类的XAML代码:

    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Viewport3DwithControls="clr-namespace:Viewport3DwithControls;assembly=Viewport3DwithControls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
    x:Class="ControllableViewport3D_Demo.MainWindow"
    x:Name="Window"
    Title="MainWindow"
    Width="640" Height="480">
    <Grid x:Name="LayoutRoot">
        <Viewport3DwithControls:ControllableViewport3D x:Name="MainViewport3D">
            <!-- SketchUp 6 to Xaml (c)2009 Itai Bar-Haim, supports: faces, normals and textures -->
            <Viewport3DwithControls:ControllableViewport3D.Camera>
                <PerspectiveCamera x:Name="myCamera" LookDirection="2508.655,-4077.894,-2871.299" Position="-1680.519,4975.945,2549.795" UpDirection="0.021,-0.033,0.999"/>
            </Viewport3DwithControls:ControllableViewport3D.Camera>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <Model3DGroup>
                        <AmbientLight Color="#333333"/>
                        <DirectionalLight Direction="135,-56,10" Color="#FF919191"/>
                    </Model3DGroup>
                </ModelVisual3D.Content>
            </ModelVisual3D>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <Model3DGroup>
                        <Model3DGroup>
                            <Model3DGroup.Transform>
                                <MatrixTransform3D Matrix="1.0,0.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0,-676.174208546767,-278.003892202022,0.0,1.0" />
                            </Model3DGroup.Transform>
                            <GeometryModel3D>
                                <GeometryModel3D.Geometry>
                                    <MeshGeometry3D
                                        Positions="189.3541,2020.1882,116.9291 189.3541,3224.0157,116.9291 189.3541,1791.8418,0 3058.2677,3487.0079,116.9291 189.3541,1791.8418,0 189.3541,2020.1882,0 0,0,0 189.3541,2518.5749,116.9291 1142.11,3487.0079,0 2798.4092,2899.7158,116.9291 189.3541,151.5748,0 2798.4092,349.391,0 0,3487.0079,116.9291
773.176,0,116.9291 1142.11,3487.0079,116.9291 2216.1258,2518.5749,116.9291 388.5066,2702.8654,116.9291 387.7793,349.391,116.9291 2798.4092,349.391,0 2936.5619,3224.0157,116.9291 1370.0628,2020.1882,116.9291 2798.4092,2899.7158,116.9291 535.0234,0,116.9291 1142.11,3224.0157,0 388.5066,2702.8654,0 2798.4092,1070.2572,116.9291
2616.9132,591.517,116.9291 1370.0628,1791.8418,116.9291 945.2596,865.5328,116.9291 388.5066,2899.7158,116.9291 1142.8974,591.517,116.9291 2936.5619,1544.6666,116.9291 189.3541,151.5748,0 1142.8974,349.391,116.9291 535.0234,349.391,116.9291 807.4485,1070.2572,0 1142.8974,591.517,0 189.3541,3224.0157,116.9291 387.7793,349.391,116.9291
0,3487.0079,116.9291 0,0,116.9291 189.3541,1791.8418,116.9291 2798.4092,2899.7158,116.9291 189.3541,2020.1882,116.9291 189.3541,2518.5749,116.9291 2621.6376,2702.8654,0 2621.6376,2702.8654,116.9291 189.3541,2306.1513,0 1370.0628,1791.8418,0 1142.11,3487.0079,116.9291 535.0234,1301.3595,116.9291 807.4485,1070.2572,0
535.0234,0,0 2216.1258,2306.1513,116.9291 1142.11,3487.0079,0 2798.4092,1791.8418,0 1625.9683,1791.8418,0 535.0234,1301.3595,0 2798.4092,1791.8418,0 2798.4092,349.391,116.9291 2936.5619,3224.0157,116.9291 1142.11,3224.0157,116.9291 2936.5619,151.5748,0 773.176,151.5748,0 2616.9132,591.517,0
535.0234,1301.3595,0 388.5066,2702.8654,116.9291 1322.7823,3487.0079,0 3058.2677,3487.0079,116.9291 189.3541,151.5748,116.9291 2936.5619,151.5748,0 535.0234,151.5748,0 2621.6376,2020.1882,116.9291 189.3541,2306.1513,0 807.4485,1070.2572,116.9291 189.3541,3224.0157,0 1142.8974,591.517,116.9291 189.3541,2020.1882,0
1142.8974,591.517,116.9291 189.3541,151.5748,0 2798.4092,1070.2572,116.9291 3058.2677,3487.0079,0 1322.7823,3487.0079,116.9291 2621.6376,2702.8654,116.9291 388.5066,2702.8654,0 535.0234,0,116.9291 2621.6376,2020.1882,0 807.4485,349.391,0 1370.0628,1791.8418,116.9291 535.0234,1301.3595,116.9291 2798.4092,1791.8418,116.9291
1625.9683,2020.1882,0 387.7793,1544.6666,0 1625.9683,1791.8418,116.9291 945.2596,865.5328,0 1370.0628,2020.1882,116.9291 1142.11,3224.0157,116.9291 945.2596,865.5328,0 1370.0628,1791.8418,0 773.176,151.5748,116.9291 1370.0628,1791.8418,0 535.0234,1301.3595,116.9291 388.5066,2899.7158,0 2936.5619,1544.6666,0
1142.8974,349.391,0 1370.0628,2020.1882,0 1322.7823,3224.0157,0 2936.5619,151.5748,116.9291 1322.7823,3487.0079,116.9291 387.7793,349.391,0 535.0234,151.5748,116.9291 189.3541,2306.1513,116.9291 1142.8974,349.391,0 1625.9683,1791.8418,116.9291 2798.4092,2899.7158,0 189.3541,151.5748,116.9291 1322.7823,3224.0157,0
2616.9132,865.5328,0 3058.2677,3487.0079,116.9291 2621.6376,2702.8654,0 1625.9683,2020.1882,0 535.0234,1301.3595,0 189.3541,2518.5749,0 387.7793,349.391,0 2936.5619,3224.0157,0 807.4485,349.391,116.9291 2216.1258,2518.5749,116.9291 535.0234,349.391,116.9291 945.2596,349.391,116.9291 2216.1258,2306.1513,0
387.7793,1544.6666,116.9291 2621.6376,2020.1882,116.9291 807.4485,349.391,116.9291 2798.4092,1791.8418,0 1625.9683,2020.1882,116.9291 2936.5619,3224.0157,0 2616.9132,865.5328,116.9291 2616.9132,591.517,0 387.7793,1544.6666,116.9291 1370.0628,1791.8418,116.9291 945.2596,865.5328,116.9291 3058.2677,0,116.9291 0,3487.0079,116.9291
807.4485,1070.2572,0 388.5066,2702.8654,0 1370.0628,2020.1882,116.9291 1322.7823,3224.0157,116.9291 2621.6376,2020.1882,0 2216.1258,2306.1513,0 1142.8974,591.517,0 2621.6376,2020.1882,0 1142.8974,349.391,116.9291 1322.7823,3487.0079,0 2936.5619,1301.3595,116.9291 1322.7823,3487.0079,0 2798.4092,1070.2572,0
2216.1258,2306.1513,0 388.5066,2899.7158,0 189.3541,1791.8418,0 945.2596,865.5328,0 1322.7823,3224.0157,116.9291 2616.9132,865.5328,116.9291 3058.2677,0,0 387.7793,349.391,116.9291 2936.5619,3224.0157,116.9291 2936.5619,1301.3595,0 2798.4092,1070.2572,0 1625.9683,2020.1882,116.9291 773.176,151.5748,116.9291
2798.4092,1791.8418,116.9291 1142.11,3224.0157,0 2616.9132,591.517,116.9291 1370.0628,2020.1882,0 189.3541,2518.5749,0 535.0234,151.5748,116.9291 2621.6376,2702.8654,0 807.4485,1070.2572,116.9291 773.176,0,116.9291 945.2596,349.391,0 388.5066,2702.8654,116.9291 1625.9683,1791.8418,0 1625.9683,2020.1882,116.9291
2936.5619,1301.3595,0 2936.5619,1544.6666,0 2621.6376,2020.1882,116.9291 1625.9683,1791.8418,0 2216.1258,2306.1513,116.9291 773.176,0,0 2936.5619,151.5748,0 2216.1258,2306.1513,116.9291 2216.1258,2518.5749,0 388.5066,2899.7158,116.9291 535.0234,0,116.9291 189.3541,1791.8418,116.9291 1322.7823,3487.0079,116.9291
1142.11,3224.0157,0 945.2596,865.5328,116.9291 807.4485,349.391,0 2216.1258,2518.5749,0 535.0234,349.391,0 945.2596,349.391,0 3058.2677,0,116.9291 1322.7823,3224.0157,116.9291 387.7793,1544.6666,0 2798.4092,1070.2572,116.9291 807.4485,349.391,0 2616.9132,865.5328,0 2936.5619,1301.3595,116.9291
189.3541,2020.1882,0 2798.4092,349.391,0 535.0234,151.5748,0 2616.9132,865.5328,0 535.0234,349.391,0 189.3541,3224.0157,0 189.3541,2306.1513,0 0,0,116.9291 945.2596,349.391,0 3058.2677,0,0 189.3541,2518.5749,116.9291 189.3541,1791.8418,116.9291 773.176,151.5748,0
2621.6376,2702.8654,116.9291 388.5066,2899.7158,0 189.3541,151.5748,116.9291 945.2596,349.391,116.9291 2936.5619,1544.6666,0 1142.8974,349.391,0 387.7793,1544.6666,0 2798.4092,349.391,116.9291 1625.9683,1791.8418,116.9291 2936.5619,1301.3595,0 2936.5619,1301.3595,116.9291 2936.5619,1544.6666,116.9291 2936.5619,151.5748,116.9291
2216.1258,2518.5749,116.9291 1142.11,3224.0157,116.9291 773.176,0,116.9291 773.176,151.5748,0 2616.9132,865.5328,116.9291 807.4485,349.391,116.9291 535.0234,151.5748,116.9291 535.0234,349.391,116.9291 189.3541,2306.1513,116.9291 189.3541,2020.1882,116.9291 2798.4092,349.391,116.9291 945.2596,349.391,116.9291 3058.2677,0,116.9291
3058.2677,3487.0079,0 189.3541,3224.0157,116.9291 535.0234,151.5748,0 189.3541,2518.5749,0 773.176,151.5748,116.9291 388.5066,2899.7158,116.9291 2798.4092,2899.7158,0 0,3487.0079,0 773.176,0,0 1142.11,3487.0079,0 2216.1258,2518.5749,0 189.3541,2306.1513,116.9291 387.7793,349.391,0
1625.9683,2020.1882,0 1142.8974,349.391,116.9291 1142.11,3487.0079,116.9291 387.7793,1544.6666,116.9291 807.4485,1070.2572,116.9291 1370.0628,2020.1882,0 2936.5619,1544.6666,116.9291 2798.4092,1070.2572,0 2936.5619,3224.0157,0 2798.4092,2899.7158,0 535.0234,0,0 2798.4092,1791.8418,116.9291 2616.9132,591.517,0
1322.7823,3224.0157,0 2616.9132,591.517,116.9291 1142.8974,591.517,0 535.0234,349.391,0 2936.5619,151.5748,116.9291 0,3487.0079,0 189.3541,3224.0157,0"
                                        TextureCoordinates="189.35413,-2020.1882 189.35413,-3224.0157 189.35413,0 3487.0079,-116.92913 189.35413,-1791.8418 -189.35413,0 0,0 2518.5749,-116.92913 3487.0079,0 2899.7158,-116.92913 189.35413,-151.5748 2798.4092,-349.39104 0,-116.92913 773.17603,-116.92913 -1142.11,-116.92913 -2216.1258,-116.92913 388.50659,-2702.8654 -349.39104,-116.92913 2798.4092,0 2936.5619,-116.92913 -1370.0628,-116.92913 -2798.4092,-116.92913 535.02342,-116.92913
1142.11,0 -2702.8654,0 1070.2572,-116.92913 -2616.9132,-116.92913 1370.0628,-1791.8418 945.25964,-865.53277 388.50659,-2899.7158 -1142.8974,-116.92913 2936.5619,-1544.6666 151.5748,0 1142.8974,-349.39104 349.39104,-116.92913 -807.44846,0 -591.51702,0 3224.0157,-116.92913 387.77933,-349.39104 -3487.0079,-116.92913 0,-116.92913 189.35413,-116.92913 2798.4092,-2899.7158 -189.35413,-116.92913 189.35413,-2518.5749 -2702.8654,0
2621.6376,-2702.8654 189.35413,-2306.1513 1791.8418,0 3487.0079,-116.92913 535.02342,-1301.3595 807.44846,-1070.2572 0,0 2216.1258,-2306.1513 1142.11,-3487.0079 2798.4092,-1791.8418 -1791.8418,0 1301.3595,0 2798.4092,0 2798.4092,-116.92913 2936.5619,-3224.0157 1142.11,-116.92913 2936.5619,-151.5748 -151.5748,0 2616.9132,-591.51702 535.02342,0 -2702.8654,-116.92913 -1322.7823,0 3058.2677,-3487.0079
151.5748,-116.92913 -2936.5619,0 151.5748,0 2621.6376,-2020.1882 189.35413,0 -807.44846,-116.92913 189.35413,-3224.0157 -591.51702,-116.92913 189.35413,-2020.1882 1142.8974,-591.51702 -189.35413,0 2798.4092,-1070.2572 -3058.2677,0 1322.7823,-3487.0079 -2702.8654,-116.92913 388.50659,-2702.8654 0,-116.92913 -2020.1882,0 -349.39104,0 1791.8418,-116.92913 1301.3595,-116.92913 2798.4092,-116.92913 -2020.1882,0
-387.77933,0 -1791.8418,-116.92913 945.25964,0 1370.0628,-2020.1882 1142.11,-3224.0157 945.25964,-865.53277 1370.0628,-1791.8418 -151.5748,-116.92913 1370.0628,0 535.02342,-116.92913 388.50659,-2899.7158 2936.5619,-1544.6666 1142.8974,-349.39104 2020.1882,0 -3224.0157,0 -2936.5619,-116.92913 -1322.7823,-116.92913 387.77933,-349.39104 151.5748,-116.92913 189.35413,-116.92913 1142.8974,0 1625.9683,-1791.8418 2798.4092,-2899.7158
-189.35413,-116.92913 1322.7823,0 -865.53277,0 -3058.2677,-116.92913 2621.6376,-2702.8654 -1625.9683,0 535.02342,-1301.3595 189.35413,-2518.5749 387.77933,0 -3224.0157,0 807.44846,-349.39104 2216.1258,-2518.5749 535.02342,-349.39104 945.25964,-349.39104 2216.1258,-2306.1513 387.77933,-1544.6666 -2020.1882,-116.92913 -349.39104,-116.92913 1791.8418,0 -2020.1882,-116.92913 2936.5619,-3224.0157 2616.9132,-865.53277 -591.51702,0
-387.77933,-116.92913 1370.0628,-116.92913 945.25964,-116.92913 3058.2677,0 0,-3487.0079 -1070.2572,0 388.50659,0 2020.1882,-116.92913 -3224.0157,-116.92913 2621.6376,-2020.1882 2306.1513,0 1142.8974,-591.51702 -2621.6376,0 1142.8974,-116.92913 -3487.0079,0 2936.5619,-1301.3595 1322.7823,-3487.0079 2798.4092,-1070.2572 2216.1258,0 -2899.7158,0 1791.8418,0 865.53277,0 1322.7823,-116.92913
-865.53277,-116.92913 0,0 387.77933,-116.92913 -3224.0157,-116.92913 2936.5619,0 -2798.4092,0 -1625.9683,-116.92913 773.17603,-151.5748 1791.8418,-116.92913 1142.11,-3224.0157 -591.51702,-116.92913 1370.0628,-2020.1882 -189.35413,0 535.02342,-151.5748 2621.6376,0 -1070.2572,-116.92913 773.17603,0 349.39104,0 388.50659,-116.92913 1625.9683,0 1625.9683,-2020.1882 -1301.3595,0 -2936.5619,0
-2621.6376,-116.92913 1625.9683,-1791.8418 2306.1513,-116.92913 0,0 -151.5748,0 2216.1258,-116.92913 2518.5749,0 -2899.7158,-116.92913 535.02342,0 1791.8418,-116.92913 -3487.0079,-116.92913 3224.0157,0 865.53277,-116.92913 807.44846,-349.39104 2216.1258,-2518.5749 535.02342,-349.39104 945.25964,-349.39104 0,-116.92913 1322.7823,-3224.0157 387.77933,-1544.6666 -2798.4092,-116.92913 807.44846,0 2616.9132,0
2936.5619,-116.92913 2020.1882,0 349.39104,0 -535.02342,0 2616.9132,-865.53277 535.02342,0 189.35413,0 2306.1513,0 0,0 945.25964,0 3058.2677,0 -189.35413,-116.92913 189.35413,-1791.8418 -773.17603,0 2621.6376,-116.92913 -388.50659,0 189.35413,-151.5748 349.39104,-116.92913 -1544.6666,0 -349.39104,0 -1544.6666,0 2798.4092,-349.39104 1625.9683,-116.92913
2936.5619,-1301.3595 -1301.3595,-116.92913 -2936.5619,-116.92913 -151.5748,-116.92913 2518.5749,-116.92913 3224.0157,-116.92913 0,-116.92913 773.17603,-151.5748 2616.9132,-116.92913 807.44846,-116.92913 -535.02342,-116.92913 535.02342,-116.92913 2306.1513,-116.92913 2020.1882,-116.92913 349.39104,-116.92913 945.25964,-116.92913 3058.2677,-116.92913 3487.0079,0 189.35413,-116.92913 535.02342,-151.5748 2518.5749,0 -773.17603,-116.92913 -388.50659,-116.92913
2899.7158,0 0,0 773.17603,0 -1142.11,0 -2216.1258,0 189.35413,-2306.1513 -349.39104,0 1625.9683,-2020.1882 -349.39104,-116.92913 1142.11,-3487.0079 -1544.6666,-116.92913 807.44846,-1070.2572 -1370.0628,0 -1544.6666,-116.92913 1070.2572,0 2936.5619,0 -2798.4092,0 535.02342,0 2798.4092,-1791.8418 -2616.9132,0 1322.7823,-3224.0157 2616.9132,-591.51702 -1142.8974,0
349.39104,0 2936.5619,-151.5748 -3487.0079,0 3224.0157,0"
                                        TriangleIndices="62 197 237 197 62 200 200 62 104 200 104 97 104 62 11 11 62 155 121 51 230 51 121 199 51 199 237 237 199 255 51 237 197 230 51 155 230 155 62 97 149 211 149 97 104 211 149 64 255 249 270 249 255 199 249 109 10 109 249 199 4 203 98 203 4 10 203 10 109 98 203 103 98 103 185 98 185 172 185 103 55 55 103 114 75 102 170 102 75 84 170 102 114 170 114 273 170 273 54 273 114 135 135 114 103 172 47 77 47 172 129 129 172 260 260 172 185 129 260 147 129 147 198 122 84 75 84 122 198 84 198 119 119 198 147 154 54 273 43 265 5 265 43 20 105 88 48 88 105 145 139 2 100 2 139 41 158 69 32 69 158 193 115 210 79 210 115 240 71 85 52 85 71 110 271 181 113 181 271 72 72 271 46 46 29 16 29 46 42 42 46 271 279 7 250 7 279 37 252 269 222 269 252 21 253 169 133 169 253 9 90 180 58 180 90 229 134 56 93 56 134 91 167 150 120 150 167 184 83 86 131 86 83 45 221 144 175 144 221 179 22 6 270 6 22 40 39 6 40 6 39 278 12 256 254 256 12 14 8 235 195 235 8 49 61 213 23 213 61 248 76 226 261 226 76 36 19 116 268 116 19 160 194 106 146 106 194 152 108 81 67 81 108 118 247 201 162 201 247 3 246 255 217 255 246 13 127 130 38 130 127 50 141 168 177 168 141 277 277 141 153 153 141 31 31 141 60 60 82 202 82 60 68 68 60 141 50 31 130 31 50 153 231 188 233 188 231 182 207 65 165 65 207 101 57 34 276 34 57 89 241 123 212 123 241 163 263 259 17 259 263 227 138 183 92 183 138 232 164 225 266 225 164 124 99 187 236 187 99 63 251 70 220 70 251 107 30 272 275 272 30 26 161 137 171 137 161 117 238 94 206 94 238 140 159 224 178 224 159 196 228 78 33 78 228 274 274 228 136 128 264 125 264 128 28 264 28 80 80 28 136 80 136 228 245 205 216 205 245 239 176 87 132 87 176 143 74 166 35 166 74 204 267 244 209 244 267 25 59 112 18 112 59 151 53 44 258 44 53 126 142 1 262 1 142 0 1 0 258 1 258 44 262 1 96 215 223 142 223 215 192 142 223 0 0 223 219 223 192 174 219 95 0 95 219 27 191 24 66 24 191 157 214 243 208 243 214 242 190 186 148 186 190 234 189 73 156 73 189 111 173 15 257 15 173 218 "/>
                                </GeometryModel3D.Geometry>
                                <GeometryModel3D.Material>
                                    <DiffuseMaterial Brush="White"/>
                                </GeometryModel3D.Material>
                            </GeometryModel3D>
                        </Model3DGroup>
                    </Model3DGroup>
                </ModelVisual3D.Content>
                <ModelVisual3D.Transform>
                    <Transform3DGroup>
                        <TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0"/>
                        <ScaleTransform3D ScaleZ="1" ScaleY="1" ScaleX="1"/>
                        <RotateTransform3D d:EulerAngles="0,0,0">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="0,1,0" Angle="0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                        <TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0"/>
                        <TranslateTransform3D OffsetY="-566.164"/>
                    </Transform3DGroup>
                </ModelVisual3D.Transform>
            </ModelVisual3D>
        </Viewport3DwithControls:ControllableViewport3D>
    </Grid>
</Window>

在我头撞墙了几天之后,我终于承认我被难住了。

不能在WPF Viewport3D派生类中动画相机

您是否尝试过使用storyboard应用动画?另外,你可以移动场景,而不是移动摄像机。这是同一种转化。