繁体   English   中英

在A框架(webvr)中使用collada对象的事件集组件

[英]Event set component using a collada object in A-Frame (webvr)

我正在尝试使用用于A帧的事件集组件插件在collada对象上创建旋转动画,我已经能够成功地使用a-box实现此功能,但希望对collada对象进行动画处理。 由于某种原因,我看不到collada对象,也不知道我要去哪里。 请查看下面的代码以获取更多信息,我们将不胜感激任何帮助,谢谢。

<html>
<head>
<title>Model Test</title>
<script src="build.js"></script>
<script src="https://aframe.io/releases/0.5.0/aframe.min.js"></script>
<script src="aframe-animation-component.min.js"></script>
<script src="component/event-proxy.js"></script>
<script src="https://unpkg.com/aframe-event-set-component@3.0.x/dist/aframe-event-set-component.min.js"></script>
<script src="https://unpkg.com/aframe-layout-component@4.1.0/dist/aframe-layout-component.min.js"></script>
</head>
<body>
<a-scene>
  <a-entity id="container" position="0 0 -2">
    <a-collada-model src="iPhone4.dae"
        animation__rotationX="property: rotation; dur: 10000;
                        easing: easeInSine; loop: true; to: 0 360 0;
                        startEvents: rotY; pauseEvents: animationPause;
                        resumeEvents: animationResume; restartEvents: animationRestart"
        animation__rotationY="property: rotation; dur: 10000;
                        easing: easeInSine; loop: true; to: 360 0 0;
                        startEvents: rotX; pauseEvents: animationPause;
                        resumeEvents: animationResume; restartEvents: animationRestart"

      position="0 1 -2">
    </a-collada-model>
    <a-mixin id="option"
             geometry="primitive: sphere; radius: .25;"
             material="color: red"
             event-proxy="listen: click; target: a-collada-model"
             ></a-mixin>
    <a-entity  position="-2.5 0 0">
      <a-entity mixin="option" event-proxy="emit: rotY" text="value: Rotation"></a-entity>
    </a-entity>
    <a-entity  position="2.5 0 0">
      <a-entity mixin="option" event-proxy="emit: rotX" text="value: Rotation"></a-entity>
    </a-entity>

    <a-entity position="0 -1.5 0">
      <a-sphere mixin="option" event-proxy="emit: animationPause" text="value: Pause"></a-entity>
    </a-entity>
  </a-entity>


  <!-- Sky. -->
  <a-sky color="#0fbbff"></a-sky>

  <a-entity position="0 0 3">
    <a-camera><a-cursor color="#FFF"></a-cursor></a-camera>
  </a-entity>
</a-scene>

</body>
</html>

首先,升级到0.6.0。 我不确定事件和动画组件如何,但是在0.6.0中,模型处理更好。
然后尝试使用collada loader作为组件,而不是像docs中那样使用原语:

<a-entity collada-model="src:iphone4.dae"></a-entity>

如果无法显示模型,则可能需要通过将iphone上载到clara.io或使用khronos / kupoman导出器,然后使用Don McCurdy的加载器来将格式切换为threejs json或.glTF。


顺便说一句,您似乎没有与事件有关的问题,但与模型有关,因此该主题还不错:p

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM