如何在 flutter 中获取 glb 文件中的动画名称

How to get animation names in a glb file in flutter

提问人:Arvind suresh 提问时间:8/8/2023 更新时间:8/8/2023 访问量:131

问:

我在我的 flutter 应用程序中使用 glb 文件,我使用 model_viewer_plus 包来渲染 glb 文件,现在我可以通过调用具有该动画名称的方法在 glb 文件中播放特定动画,现在我需要获取 glb 文件中存在的所有动画名称,我在 model_viewer 文档中找不到任何方法来获取所有动画名称, 有人可以帮我解决这个问题吗? 演示代码,其中我使用特定的动画名称在 glb 文件中播放动画。

 ModelViewer(
              id: "modelID",
              onWebViewCreated: (controller) => {
                _controller = controller,
              },
              key: const ValueKey('Capoiera'),
              relatedJs: """
                    function setAnimationName(animation) {
                      const modelViewer = document.querySelector('#modelID');
                      modelViewer.animationName = animation;
                    }""",
              //  animationName: 'Taunt',
              //'_bee_hover'Capoiera'
              backgroundColor: Colors.transparent,
              src: 'assets/DamagedHelmet.glb', // a bundled asset file
              alt: "A 3D model of an astronaut",
              ar: true,
              autoPlay: true,
              animationCrossfadeDuration: 400,
              arModes: const ["webxr", "scene-viewer"],
              autoRotate: false,
              cameraControls: true,
              disableZoom: false,
            ),
Flutter 动画 3D GLTF 模型查看

评论


答: 暂无答案