I'm working with a world map layer as a plane geometry and I need to handle click events on different parts, such as continents or countries. I want to show popup events on specific parts like information, videos, or image data with links. How can I achieve this?
Check out this fiddle that already has the scene set up.
var camera, scene, renderer;
var geometry, material, mesh;
window.addEventListener("click", onClick, false);
function onClick() {
alert("Replace me with code to add an object!");
}
var init = function () {
// initialization code here
}
var animate = function () {
// animation code here
}
init();
animate();
The click event is currently applied to the whole scene, so when you click on any part, the same click event is triggered for all parts. You need to figure out how to handle click events on specific parts of the map.