我在我的A帧场景中使用了gltf模型,由于该模型有超过1个可用的动画,我想知道如何指定要播放的动画。这是我的模型的代码:
<a-gltf-model
scale="0.1 0.1 0.1"
src="https://cdn.glitch.com/18a85eac-a71c-4578-ad89-80f59b3a68c3%2Fscene%20(95).glb?v=1619716622287" nimation-mixer="clip:Take 001; loop:2; timeScale: 1; crossFadeDuration: 1"
animation__position1="
property: position;
from: 0 0 0;
to: 0 0 -5;
dur: 5000;
easing: linear;
autoplay: true;"
animation__position2="
property: position;
from: 0 0 -5;
to: 5 0 -5;
dur: 5000;
easing: linear;
startEvents: animationcomplete__position1">
</a-gltf-model>这是我从sketchfab下载的模型:https://sketchfab.com/3d-models/sci-fi-camera-drone-3dbf07385d1b471a96dce6de6cba97d6
动画目前不能工作,我想知道如何才能像在sketchfab中那样让模型动画。
发布于 2021-04-29 23:42:40
您可以使用animation-mixer component:进行play gltf-model animations
<html>
<head>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.1/dist/aframe-extras.min.js"></script>
</head>
<body>
<a-scene>
<a-entity gltf-model="https://gftruj.github.io/webzamples/aframe/assets/models/mech_drone/scene.gltf"
scale="0.01 0.01 0.01" position="0 0.5 -3" rotation="0 180 0"
animation-mixer></a-entity>
</a-scene>
</body>
</html>
模型由Willy Decarpentrie创建
播放特定动画需要指定一个剪辑:
animation-mixer="clip: walk"https://stackoverflow.com/questions/67319932
复制相似问题