如何使用onMouseover事件在AFrame中控制.gtlf2网格动画? [英] How can I control a .gtlf2 mesh animation in aframe with onmouseover event?

查看:22
本文介绍了如何使用onMouseover事件在AFrame中控制.gtlf2网格动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试控制(开始/停止)鼠标悬停时的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

有人知道如何实现这一点吗?

推荐答案

您可以使用animation-mixer组件来使用gltf动画。

首先,您需要使用Kupoman's exporter导出您的模型。我使用过Khronos group one,但它在导出包含多个动画的模型时遇到了问题。

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

然后您可以这样使用它:

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

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

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

还请务必查看Don McCurdysguide

这篇关于如何使用onMouseover事件在AFrame中控制.gtlf2网格动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆