lower geomoetric complexity and faster refresh

trail
Fabien Benetou 1 year ago
parent 4b0026c4ec
commit b741848ebb
  1. 5
      jxr.js

@ -3528,7 +3528,6 @@ AFRAME.registerComponent('trail', {
.sort( (a,b) => a.dist > b.dist) .sort( (a,b) => a.dist > b.dist)
if (hits.length>0) { if (hits.length>0) {
setFeedbackHUD('touching') setFeedbackHUD('touching')
console.log(hits) // problem here...
hits[hits.length-1].el.setAttribute('color', 'red') hits[hits.length-1].el.setAttribute('color', 'red')
} }
if (previousPos && previousPos.distanceTo(pos) < 0.1) return // threshold to avoid cluttering if (previousPos && previousPos.distanceTo(pos) < 0.1) return // threshold to avoid cluttering
@ -3537,11 +3536,13 @@ AFRAME.registerComponent('trail', {
el.setAttribute('position', AFRAME.utils.coordinates.stringify( pos ) ) el.setAttribute('position', AFRAME.utils.coordinates.stringify( pos ) )
el.setAttribute('color', 'green') el.setAttribute('color', 'green')
el.setAttribute('opacity', '0.3') el.setAttribute('opacity', '0.3')
el.setAttribute('segments-radial', '6')
el.setAttribute('segments-height', '2')
el.className += 'trail' el.className += 'trail'
this.el.appendChild(el) this.el.appendChild(el)
previousPos = player.getAttribute('position').clone() previousPos = player.getAttribute('position').clone()
previousPos.y = 1 previousPos.y = 1
}, 500) }, 50)
}, },
remove: function () { remove: function () {
// should remove interval, possible visual trail too // should remove interval, possible visual trail too

Loading…
Cancel
Save