aframe - 如何在框架上检测到我的声音时让 3D 模型头像说话
问题描述
我想要的是在一个框架上,当我说话时,我的 3D 模型头像也正在说话。
按照本指南https://aframe.io/docs/1.1.0/introduction/models.html#animating-models,我使用此资源创建了 3D 模型头像https://sketchfab.com/3d-models/bake -talking3-e715ab67be934a108d0a952d90c07210
但是这个 gltf 3D 模型一直在说话。每当我说话时,我都需要交互式 3D 模型说话。
假设我的语音检测已经实现。
请问有人能回答这个吗?
解决方案
该animation-mixer
组件有两种方法可以帮助
- playAction() 将播放
- stopAction() 将停止
假设我的语音检测已经实现。
然后您的代码可能如下所示:
const modelEntity = document.querySelector("[gltf-model]")
const animationComponent = modelEntity.components["animation-mixer"]
mySpeechRecognition.onspeechstart = function() {
animationComponent.playAction();
}
mySpeechRecognition.onspeechend= function() {
animationComponent.stopAction();
}
就像我在这个故障中所做的那样。绿色播放,红色停止。单击鱼以查看来源。
推荐阅读
- laravel - Laravel - 错误的密码在日志中生成“错误”
- kotlin - Kotlin 中的数组操作
- reporting-services - 如何对 SSRS 中不同的组值求和
- java - 在 Swagger Api 中动态显示 RequestBody 元数据
- typescript - 如何在打字稿中创建字典列表?
- javascript - socketio 仅在函数中使用 window.alert 时有效
- javascript - 你如何在js中取消指定变量
- flutter - 我想在 Flutter 中将我的行分成 1/4 的比例
- c# - 如何在我的 C# 中显示来自 rss.xml 的链接元素
- microsoft-graph-api - Microsoft Graph Powershell 模块