- Home /
How to create countries objects in a Sphere?
So I have a project that is basically creating Earth. So what I did is I created a sphere, attached a texture for the water. But what I want to do with it is this: I want it to be like when i click a specific country, it'll display the cities in the country. So my problem is, how do I implement the countries? I was thinking of making them individual gameobjects per country but, how do I make them like concave/convex when I attach them to the sphere/earth? Or is there another way of doing this? please help.
Have you attempted anything so far that you can share? Otherwise it's a pretty wide question and would be better on the forums.
I'd go with coordinates detection in the sphere, comparing later the coordinates with a polygon map of earth's countries. You will need ray casting and the polygon map, I found it here: http://www.rjruss.info/2010/12/free-countries-of-world-in-polygon-kml.html
Create a second image with the same aspect ratio of the earth image. Give each country (or each area you want to make clickable) a unique color. You can then use the RaycastHit.textureCoord to map into your second image and get the color.
http://answers.unity3d.com/questions/516609/empty-spaces-in-buttons-are-detected-by-mouse.html
Answer by LSPressWorks · Aug 13, 2014 at 03:40 PM
Create the countries(as warped planes, ie a leaf), attach them as children, position them. Tag them with country name. Then instead of a local map you're only checking to see if it's an objects tag, and possibly if the clicked pixel is transparent. This is effectively a translation of how we did our globes in class. Turned out very versatile.
yes. But the globe has a curve right, do you know how to bend the planes? so that itll realistically look like it is a part of the globe?
Answer by Kronnect · Dec 08, 2015 at 11:53 AM
Check out World Political Map on the Asset Store. It's uses a procedural/vector approach.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Best way to load high volume of particles. 1 Answer
Distribute terrain in zones 3 Answers
How to Check if a component Exists on a Gameobject. 3 Answers