Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Getting close to a target object, e.g. here latest added PDF, makes it grow for any avatar within a 5m radius
var avatars = document.querySelectorAll("[networked-avatar]")
var PDFs = AFRAME.scenes[0].querySelectorAll("[media-pdf]");
var mostRecentPDF = PDFs[PDFs.length-1]
if (scalingTrigger) clearInterval(scalingTrigger)
var scalingTrigger = setInterval(nearbyAvarScaleUp, 300)
function nearbyAvarScaleUp(){
for (var avatar of avatars) {
var dist = mostRecentPDF.object3D.position.distanceTo( avatar.object3D.position)
if (dist<5) mostRecentPDF.object3D.scale.addScalar( 0.1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.