1
votes

I am playing with Aframe (version 0.8.0) sometime now. I am stuck at one problem, I have been searching for its solution for couple of days but failed thus this question.

My problem is how can I change camera rotation without having to drag on canvas?

I tried these things but they didn't work:

  • camera.setAttribute('rotation', {....})
  • camera.object3D.children[0].rotation.x = 0 // some value
  • putting camera entity as the child of another entity and changing the rotation of parent entity is not what I am looking for

Any hint would be appreciated, thanks...

Update: this problem occurs only with version 0.8. There is no such error in previous version 0.7.1.

1

1 Answers

2
votes

You're milage will vary but you could try:

https://glitch.com/edit/#!/a-frame-rotate-camera-test

    AFRAME.registerComponent("rotate", {
        init: function () {
          document.body.onkeyup = (e) => {
            if(e.keyCode == 32){
              this.el.components['look-controls'].yawObject.rotation.y += 1
            }
          }
        }
    });