I'm quite new to AR, so the answer to this question may be simple. I've written a simple component that changes the colour of a box once clicked. This component works in VR mode however it doesn't work at all in AR mode when I tap the screen on the phone.
AFRAME.registerComponent('change-color', {
schema: {
color: {
type: 'string',
default: 'blue'
}
},
init: function () {
var data = this.data;
var el = this.el;
el.addEventListener('click', function () {
this.setAttribute('color', data.color);
})
}
});
<a-box id="box" position="0 1.6 3" scale="0.50 0.50 0.50" color="red" change-color></a-box>