Search code examples
three.jswebgl-globe

Selecting bars in the WebGL Globe (Google)


We all know http://www.chromeexperiments.com/globe/ WebGL experiments and I really got interested in what they did there.

What they do there is they build bars on a globe based on GPS (JSON format) information. Pretty cool in itself.

While waiting on three.js library documentation getting more complete I'd like to ask a question. How would I implement a method that would investigate which bar was ie. clicked?

Thanks in advance, Karpo


Solution

    1. You would need to put the bars in a group if they aren't already.. (the meshes)
    2. You would need to use Projector and Ray to determin the clicked object:

      http://mrdoob.github.com/three.js/examples/webgl_interactive_cubes.html

    And from here on it would be pretty easy.. you would need a way to distinguish between the bars somehow...maybe with the mesh's 'name' attribute..