Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by lella · Aug 29, 2012 at 06:51 PM · texturemap

Clickable map

Hello Everyone,

I am starting to explore Unity 3D to use it as a game engine for my project an I do have a question . I am trying to make my first scene in which I will have a rotating globe and I need to have a script that allows me to specifiy certain countries to be clicked on and another scene should be loaded... Pls if anyone can explain to me how to do it in details I will appreciate it

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by ScroodgeM · Aug 29, 2012 at 07:00 PM

solution 1 - colliders

split a globe model to sub-meshes with countries silhouettes with accuracy you need. now you can catch clicks separately to each country by mapping this meshes to countries

solution 2 - masks

make a alpha-masks for each country. ask should be a texture with alpha-selected country silhouette. on click you just should check clicked pixel (pixel can be gotten by raycast) on each texture and where this pixel is enabled (mask present) - this is your country. this way also lets you highlight countries on mouse hover easily.

this is example of globe texture:

alt text

imagine this texture on globe with sphere collider. once we raycast globe from mouse position with hit returned, we got texture coordinates of this hit.

and this is the mask of Russia country:

alt text

both textures are (and should be) the same size. now check clicked coordinates from first texture on this texture with transparency only channel. if a pixel in clicked coordinates is white, we clicked Russia country, or else - we clicked somewhere else.


2.jpg (21.0 kB)
1.jpg (76.7 kB)
Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image lella · Aug 30, 2012 at 09:31 PM 0
Share

I am sorry I can't get it can you explain more?!!!!

avatar image ScroodgeM · Aug 30, 2012 at 09:45 PM 0
Share
  1. don't post comments as answers.

  2. explained second solution, first is too hard 8)

avatar image Bunny83 · Aug 30, 2012 at 10:02 PM 0
Share

@lella: I've converted your answer into a comment.

avatar image Bunny83 · Aug 30, 2012 at 10:04 PM 0
Share

Btw. It seems this is a quite similar question to this one:

http://answers.unity3d.com/questions/289506/view.html

avatar image ScroodgeM · Aug 30, 2012 at 10:11 PM 0
Share

good idea about different colors for areas and single map for all 8) simple shader improvement that let you highlight covered by mouse (or some other pointer) area will make a nice tool 8)

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Assigning UV Map to model at runtime 0 Answers

ID multidimensional array to mesh and textures 0 Answers

Texture sprite goes crazy when I repeat it 1 Answer

How to set up a world map texture on a series of individual country meshes? 1 Answer

Fit image to plane 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges