【发布时间】:2018-06-19 02:26:52
【问题描述】:
我是 Aframes 的新手,我正试图弄清楚如何在单击球体时将其带到右手(Vive 控制器)的位置(想想绝地武力拉动类型动画)。
这是我目前所拥有的,我不确定要为“右手位置”填写什么
<a-scene >
<a-entity id="leftHand" hand-controls="left"></a-entity>
<a-entity id="rightHand" hand-controls="right"></a-entity>
<a-entity laser-controls="hand: right"></a-entity>
<a-sphere class="sphere" id="mySphere" position="1 1 1" radius=".2" color="#2AFF00"
bring-sphere-to-hand="">
<a-animation attribute="position" from="1 1 1" to=<position-of-right-hand> dur=2000 begin=spherePull></a-animation>
</a-scene>
然后在我的 javascript 里面我有...
AFRAME.registerComponent('bring-sphere-to-hand', {
schema: {},
init: function () {
var el = this.el;
el.addEventListener('click', function () {
el.emit('spherePull');
});
}
});
显然这段代码不起作用,因为“右手位置”不是一个东西。谁能给我一些关于如何使这项工作的指示?我的猜测是,点击它后,我需要添加一个克隆球体作为右手的孩子,然后将其拉到稍微修改的(0,0,0)。我在正确的轨道上吗?如果是这样,我能得到一些关于如何去做的指示吗?
【问题讨论】:
标签: aframe virtual-reality htc-vive