2

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

gman
  • 100,619
  • 31
  • 269
  • 393
Karpo
  • 23
  • 2
  • I try to use the newest rev 50 version of Three.js and modify the WebGL Globe to match its correct function names etc. I think I got it right but I get an error at addPoint() function where it tries the following: GeometryUtils.merge(subgeo, point); I changed it to THREE.GeometryUtils.merge(subgeo, point). Console says "uncaught TypeError: cannot read property id of null. Ideas? – Karpo Sep 04 '12 at 16:42
  • The very same problem was discussed here aswell: http://code.google.com/p/webgl-globe/issues/detail?id=18 – Karpo Sep 04 '12 at 20:09

2 Answers2

3
  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..

EliSherer
  • 1,597
  • 1
  • 17
  • 29
1

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.

Torsten Becker
  • 4,330
  • 2
  • 21
  • 22