I have a cluster of orbs arranged in the following pattern:
https://i.sstatic.net/9FhsQ.png
Each orb is evenly spaced from one another. The code I am using for this setup is:
geometry = new THREE.SphereGeometry(1.2);
material = new THREE.MeshPhongMaterial({
color: 0xe0e0e0
})
for (var zPos = -120, i = 0; zPos <= 120; zPos += 7, i++) {
arr[i] = [];
for (var xPos = -120, j = 0; xPos <= 120; xPos += 7, j++) {
arr[i][j] = "(" + i + "," + j + ")";
sphere = new THREE.Mesh(geometry, material);
sphere.position.set(xPos, 0, zPos);
sphere.name = i + "-" + j;
count++;
sphere.receiveShadow = true;
sphereMesh.add(sphere);
}
rows++;
}
scene.add(sphereMesh);
In this case, sphereMesh acts as a Group.
The issue I am facing is that when I provide a specific position as input, I want to select the orbs nearby within a certain radius and change their color. How can I identify the orbs close to the given position?