Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HyroVitalyProtago/e22486e96b724eedbfc51c42eac59b67 to your computer and use it in GitHub Desktop.
Save HyroVitalyProtago/e22486e96b724eedbfc51c42eac59b67 to your computer and use it in GitHub Desktop.
A < 20 line (Hack-ish) A-Frame Outline Geometry component
AFRAME.registerComponent('outline-geometry', {
schema : {
margin : { default : 1.025 },
color: { default : 'red' },
},
init : function () {
var p = this.el;
var p_prime = p.cloneNode(true);
p_prime.removeAttribute('outline-geometry')
p_prime.setAttribute('material', 'color', this.data.color)
p_prime.setAttribute('material', 'side', 'back')
p_prime.setAttribute('position', '0 0 0')
let s = this.data.margin
p_prime.setAttribute('scale', `${s} ${s} ${s}`)
this.el.appendChild(p_prime)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment