3

我正在尝试控制(开始/停止)鼠标悬停的 gtlf 动画。我找到了一个很好的例子,但它依赖于 .json 格式的模型:

示例:https ://rexraptor08.github.io/animation-controls/

来源:https ://github.com/rexraptor08/animation-controls

问题是我不再能够从搅拌机导出 .json 格式,因为插件已被删除:https ://github.com/mrdoob/three.js/tree/dev/utils/exporters/blender

任何人都知道如何实现这一目标?

4

1 回答 1

4

您可以使用动画混合器组件来使用 glTF 动画。

首先,您需要使用Kupoman 的 exporter导出模型。我使用了 Khronos 第一组,但它在导出具有多个动画的模型时遇到了问题。

导出模型后,只需包含aframe-extras即可使用动画加载器。

然后你可以像这样使用它:

<a-entity gltf-model="url(model.gltf)"
   animation-mixer="clip: DoStuff;"></a-entity>

如果要使用任何事件启动动画,只需创建一个组件,它将设置animation-mixer

this.el.addEventListener("click", (e)=> {
  this.el.setAttribute("animation-mixer", "clip", "DoStuff") 
})

还请务必查看 Don McCurdys指南

于 2018-06-27T08:54:58.220 回答