Reputation: 13
I am currently trying to get button input from the Oculus Touch buttons. I was able to attach a laser-controls to the control but I would like to be able to toggle the laser on and off. Not sure if this possible but I'm currently working with this setup that yields no response:
<script>
AFRAME.registerComponent('x-button-listener', {
init: function() {
var el = this.el;
el.addEventListener('xbuttondown', function(evt) {
var cameraEl = document.querySelector('#cameraRig[#left-hand]');
cameraEl.removeAttribute('laser-controls');
});
}
});
</script>
and
<a-entity id="cameraRig">
<a-entity x-button-listener id="left-hand" teleport-controls="button: trigger; collision-entities: #ground" laser-controls="hand: left"></a-entity>
</a-entity>
Any help would be greatly appreciated.
Upvotes: 1
Views: 222
Reputation: 13233
You want to do .setAttribute('raycaster', 'showLine', false)
, not remove laser-controls
.
Upvotes: 0