javascript - A-frame 持续为 gltf 设置动画以转到相机 A-frame 的位置
问题描述
我正在使用 A-frame ( https://aframe.io ) 创建一个 vr 场景,我想知道如何为 gltf 模型设置动画以始终跟随相机。例如,我想使用 A-frame 的动画属性并定位我的模型,使其始终跟随玩家。如果玩家向前移动 10 米,则 gltf 将动画向前 10 个空间。如果玩家向左移动 10 格,无论玩家移动到哪里,摄像机都会跟随玩家。我想让 gltf 模型始终跟随相机。如何才能做到这一点?我的 gltf 模型的代码:
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<a-scene>
<a-gltf-model class="cube" mixin="cube" animation=' property: position; dur: 2500; from: 0 2.3 -1; to: 0 2.5 -1; dir: alternate; autoplay: true; easing: linear; loop: true;' src="https://cdn.glitch.com/bb5471f0-16f5-4309-8c7c-52310dc4ff58%2FRobotfr.glb?v=1625527911166" position="0 2.3 -1"scale="1.2 1.2 1.2" speech-command__show="command: assistant; type: attribute; attribute: visible; value: true;"speech-command__hide="command: hide; type: attribute; attribute: visible; value: false;"></a-gltf-model>
</a-scene>
解决方案
推荐阅读
- git - 如何将本地提交的更改重新应用为来自分支的合并提交?
- android - 在 android studio 项目中导入 Unity 应用程序
- ios - 可以用试试!并强制解包以更新 Firestore 中的数据会导致崩溃?
- python - 如何检查Python中的任何变量是否为NaN?
- google-drive-api - 恢复以前版本的 Google Doc
- sql - Oracle SQL - 按组计数空数并添加新列
- c++ - 模板参数推导/替换失败的可变参数模板
- ios - APP NOTIFICATION PUSH 苹果的标识符a的变化
- python - opencv-python错位图像拼接
- java - Spring @Required Annotation 已弃用?