animation - 是否可以附加到threejs/aframe 中的动画glb 对象?
问题描述
我有一个在场景中移动的对象,我将其导出为 .glb(模型 A)。
在 Aframe 中,我正在使用animation-mixer
标签在模型 A 上播放动画,并且可以看到对象四处移动。现在我要做的是附加另一个模型(模型 B),以便模型 B 也在场景中移动。但是,模型 B 只是停留在原地 - 在指定的模型 A 位置。
有没有办法在 Threejs/Aframe 中实现这一点?
到目前为止,我已经重新审视了这项技术并拥有以下代码,但是模型的位置在它的静态位置和它在刻度中设置的位置之间闪烁。
<a-entity id="mantaray-path" gltf-model="#mantaray-path-glb" animation-mixer="timeScale: 1; loop: true;" pathanim></a-entity>
<a-entity id="mantaray" gltf-model="#mantaray-glb" animation-mixer="timeScale: 1;"></a-entity>
AFRAME.registerComponent("pathanim", {
init: function() {
this.el.addEventListener('model-loaded', this.update.bind(this));
},
tick: function() {
this.el.object3D.traverse(function(child) {
if (child.name == "mantaraypath") {
mantaray.object3D.position = child.position;
}
});
}
});
解决方案
推荐阅读
- selenium - 无法在 jbehave 中运行我的配置文件
- security - 爬取域以获取参数的另一种方法是什么?(因为 burp 2.1 不允许在社区版中使用蜘蛛)
- javascript - php发送多个参数到另一个页面
- reactjs - 如何在 whmcs 的本机应用程序中发送发布请求
- c# - 将 .xlsx 文件转换为 .xls(97-2003) 工作簿 C#
- javascript - 如何检查单选按钮是否被选中以显示按钮以继续
- amazon-sagemaker - AWS SageMaker - 提交按钮不适用于自定义模板
- android - android studio和firebase的登录错误
- android - 单击通知后启动器活动正在打开(应用程序已关闭)
- opencv - 如何找到两个简单形状之间的单应性?