Selecting 3D Objects with Mouse or Device

Say you have generated a Grid of Spheres in a 3x3 Grid. Is it possible to select any of those Spheres with an input device?

Yes, there are different ways you could accomplish this with some math.

One would be to check if the pointer is within a certain distance of each individual sphere’s (x,y) center point — sphere-hover-distance.vuo

Another would be to calculate which grid space the pointer is in — sphere-hover-grid.vuo

Btw, I’m not totally clear on what you mean by “select”, but hopefully one of the two compositions matches what you had in mind. The first one draws a selection indicator (square) behind the sphere being hovered. The second picks out the sphere being hovered and does something to it (replaces it with a cube).

sphere-hover-distance.vuo (7.66 KB)

sphere-hover-grid.vuo (10.4 KB)

I will implement one of these solutions. I’m tempted towards the distance rather than grid. That way can have more control over thresh-hold.

1 Like