Skip to content

Instantly share code, notes, and snippets.

@daniel-schroeder-dev
Created November 18, 2020 00:48
Show Gist options
  • Select an option

  • Save daniel-schroeder-dev/888c061ef5f847bfa6edef377491162f to your computer and use it in GitHub Desktop.

Select an option

Save daniel-schroeder-dev/888c061ef5f847bfa6edef377491162f to your computer and use it in GitHub Desktop.
var scene;
function start(){
scene = $('a-scene');
zombie = $('.dummy-creeper');
addCreeper();
}
function build(event) {
var clickedPosition = event.detail.intersection.point;
var position = `${clickedPosition.x} ${clickedPosition.y} ${clickedPosition.z}`;
var clone = $('.dummy-block').clone();
clone.attr('visible', true);
clone.attr('position', position);
scene.append(clone);
}
AFRAME.registerComponent('build-stuff', {
init: function() {
$(this.el).on('click', build)
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment