Hi so i’m trying to hide multiple tree meshes if they are a certain distance away but i can’t seem to do it? any idea’s:
scene.traverse(function(child) {
for (let i = 0; i < child.length; i++) {
if (child.name.includes('Tree')) {
var distance = pl.position.distanceTo( child[i].position );
if (distance >= 20)
{
child[i].visible = false;
console.log('far', child[i]);
}
else {
child[i].visible = true;
console.log('close', child[i]);
}
}
}
});