AFRAME.registerComponent('rotation-limiter', {
  tick: function () {
    var el = this.el;
    var rotation = el.getAttribute('rotation');

    rotation.x = Math.max(0, Math.min(90, rotation.x));
    rotation.y = Math.max(0, Math.min(90, rotation.y));
    rotation.z = Math.max(0, Math.min(90, rotation.z));

    el.setAttribute('rotation', rotation);
  }
});