Reputation: 11
This code worked for me once but does no longer. I am trying to figure out how to rotate an entity the wraps a few elements in a scene.
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++;
}
Upvotes: 1
Views: 617
Reputation: 14645
Although your method seems to be working, I'm not sure if messing with the attrValue
is a proper way.
Instead try getAttribute('rotation')
or entityEl.object3D.rotation
(radian output!)
Upvotes: 2