diff --git a/index.html b/index.html index 74fe764..88092b4 100644 --- a/index.html +++ b/index.html @@ -2956,6 +2956,8 @@ AFRAME.registerComponent('dynamic-unless-picked', { // should unregister on remove }) +// e.g usage within player entity : +// AFRAME.registerComponent('collider-check', { dependencies: ['raycaster'], @@ -2977,6 +2979,21 @@ AFRAME.registerComponent('collider-check', { } }); +// e.g usage within player entity : +// +AFRAME.registerComponent('collision-check', { + dependencies: ['raycaster'], + + init: function () { + this.el.addEventListener('raycaster-intersection', function (e) { + color = e.detail.els[0].getAttribute("color") + let rig = document.getElementById("rig").getAttribute("position") + if (color == "red") + rig.z += .5 + }); + } +}); + // used for testing AFRAME.registerComponent('startfunctions', { init: function () { @@ -3017,7 +3034,7 @@ AFRAME.registerComponent('startfunctions', { - +