Reputation: 23
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
Upvotes: 2
Views: 823
Reputation: 4323
Depending on the amount of bars I'd use the ray on the globe and select the bar via latitude and longitude, which is much faster. Also it does not rely on user's capabilities to click tiny bars.
Upvotes: 1
Reputation: 1647
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..
Upvotes: 3