- Home /
Applying hegihtmap to hexagonal grid
Hi all, got kind of a tricky problem here and I wanted to get some thoughts on the best strategy.
I've built a hexagonal grid mesh, and I would like to apply some kind of heightmap to it. It's kind of tricky to describe, so I drew a picture:
This is top down, imagine that each hexagon is its own GameObject with its own mesh. How would I go about splitting up the heightmap and adjusting each vertex of the mesh so that it's height aligns with the nearest pixel in the heightmap?
Banging my head against the wall, I've got a few tentative ideas, none of them good:
Create some sort of plane with the heightmap as a texture, align it with the hex grid, and perform some kind of raycast between the two to check the nearest pixel,
Iterate through the pixels on the heightmap and check their coordinates with the universal coordinates of each vertex on the whole map (not sure how to do that since each tile is a gameobject),
Split the heightmap somehow and pass the individual sections to each hex tile, then do the iterating option above.
These all seem overcomplicated and bad, which makes me wonder if my overall idea is overcomplicated and bad. Is this at all feasible, or should I be doing this another way (like use a terrain)?
Your answer

Follow this Question
Related Questions
using grayscale texture as heightmap, vertices and pixel don't match 0 Answers
Import a 513x513 Texture2D (heightmap) 0 Answers
Heightmap on primitive plane 2 Answers
Terrain Clone 0 Answers