【问题标题】:How to return current rotation of Aframe entity如何返回 Aframe 实体的当前旋转
【发布时间】:2017-09-14 23:55:11
【问题描述】:

这段代码曾经对我有用,但不再有用。我试图弄清楚如何旋转一个实体,将几个元素包裹在一个场景中。

 var entityEl = document.querySelector('#rotate');
    console.log(entityEl.components);//returns components object
    var entityRotY = entityEl.components.rotation.attrValue.y;//rotation is undefined

    function rotate(){
        entityEl.setAttribute('rotation', {x: 0, y: entityRotX + 1, z: 0});
        entityRotY++;
    }

【问题讨论】:

    标签: javascript html aframe


    【解决方案1】:

    虽然你的方法seems to be working,但我不确定弄乱attrValue是否是正确的方法。

    试试getAttribute('rotation')entityEl.object3D.rotation(弧度输出!)

    【讨论】:

      猜你喜欢
      • 2019-08-04
      • 1970-01-01
      • 2021-05-11
      • 1970-01-01
      • 1970-01-01
      • 2018-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多