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
3
Question by Jacob 1 · Jul 19, 2010 at 07:30 PM · 2dtexturegridhighlighthexagon

Highlighting tiles on a hexagonal grid

I asked this in the forums but I thought it might be better to ask here. I hope that is ok.

I am pretty new to unity, but have a bit of an OpenGL background. I have a plane with a texture on it that contains a map (for a TBS). The map is going to have a hexagonal grid (although the lines will not necessarily be drawn on). I would like to be able to highlight (by lightening) a selection of tiles to display the range of movement and darken certain tiles for fog of war. What would be the best way of doing this?

Comment
Add comment · Show 2
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 Julian-Glenn · Jul 19, 2010 at 09:04 PM 1
Share

That's a pretty tall order so I'd suggest spending a few days reading the documentation, working the tutorials, watching vids, etc. There are 100's of different ways to skin a cat with Unity (or any program$$anonymous$$g problem for that matter). For example i'd have each hex as a separate mesh in a prefab and prolly an arraylist, use raycasting to deter$$anonymous$$e which hex my mouse is over and then change the texture of it's neighbor hexes within a certain range or by Tag even, then have them instantiate a particle effect maybe, or...lots of ways.

avatar image Jacob 1 · Jul 20, 2010 at 04:56 PM 0
Share

Thanks for the advice. I am far from new to program$$anonymous$$g but yeah, unity is a bit different. I did think about doing each hex as a separate mesh. I wanted to see if there was a viable solution without doing that first.

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by pyro · Jul 19, 2010 at 09:55 PM

One way you could do this is with ParticleEmitters. If you are very new to Unity your best bet is to check the Penelope tutorial because they use Particles to represent 2D sprites for the Orbs you collect, and you can easily modify that code into an overlay system you can use for your game grid. Also it ends up only costing 1 draw call if you do it right.

Make a 50% gray hexagon texture with appropriate alpha channels and then use that as the particle, and in the Particle Renderer set it to "Horizontal Billboard". Then use a lighter color in the shader to lighten the texture below it, a darker one to do the reverse. Different colored ones to indicate movement or attack range, etc.

Comment
Add comment · Show 4 · 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 Jacob 1 · Jul 20, 2010 at 04:50 PM 0
Share

Thanks, I'll check out that tutorial.

avatar image Sammual12 · Sep 03, 2010 at 07:29 PM 0
Share

I am looking to do the same thing so please let me know how this works for you!

avatar image Sammual12 · Jun 23, 2011 at 03:36 PM 0
Share

How did this work out for you?

avatar image solana · Feb 14, 2012 at 02:48 AM 0
Share

I can render the shape I want (hexagon,square ...) but how do I fix the position of the particles ?. The penelope game has random setup for the orbs right?

Any advice please

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

2 People are following this question.

avatar image avatar image

Related Questions

2D Grid Question 0 Answers

Texture grid displayed oddly when width =/= height 1 Answer

determine neighboring cells on a hex grid. 2 Answers

creating 2d table\chess board\2d array 2 Answers

2D cube material pattern not repeating 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