16 February, 2016

AFrame Clickable Entities
By: Matthew Jackson

A-Frame tutorials use "document.querySelector"; however, using document.querySelectorAll, has a bug that doesn't apply. Also if you want to affect newly added objects, querySelector was having issues (Edit: It is working now).

Luckily, we have a workaround to use jQuery.

      this.setAttribute('material', 'color', 'red');

With the above code you can click on any object as long as it is in the cross hairs.

Tags: AFrame