- Home /
Creating Hex Grids from Mesh Vertexes
Hello. I have a mesh. and I want to detect or create a Hex mesh from it's vertex. I mean that I want to select some vertex from my mesh then create a Hex mesh from them. for me Hex mesh can be a single mesh or an object that created from 6 line. both is good for me . how can i do this?
this is concept that i want :somting like this ( but more careful hex )
Why do you want to make it from an existing mesh? Seems like it would be easier to just make it from scratch.
But, it will be just a flat plane -- no one will see the hex-shapes blue lines. Only change will be wiggly edges. The entire point of the plane in that picture is to look like hills and bumps, while hiding that it's really just a bunch of squares.
Using a texture might be better. I feel like there are answered Q's here about "how do I make a hex grid."
Or, put differently, might be better to start with the end result -- the way it should appear -- then think about how to do it.
It is unclear what you want to do here. If the hex mesh does not need to align with the vertices of the underlying mesh, then you can:
Pick a center point for the hex.
Generate the six corners of the hex on the XZ plane using the center point.
Use either raycasting or Terrain.SampleHeight() (if it is a terrain) to set the 'y' height of each vertex.
To get interlocking hexes, just move the center point in a hex fashion and walk a grid above your terrain. It is unclear here if you want multiple hexes meshes, or a single mesh with multiple hexes in that mesh. If it is the latter, you have to decide if you want to share vertices in the mesh.
I can't use Texture ! I want to able to click on each mesh. I want $$anonymous$$ultiple hexes meshes . I Want some thing like this :
or
You may want to change your approach. Your hex grid can not be aligned with squares on the underlying mesh. You may notice on the first image you posted, hex's edges are not of the same length. As robertu suggested you can create vertices from scratch. Look on the subject of procedural mesh generating.
Your answer
Follow this Question
Related Questions
Hex grid Help, Move from Cartesian coordiantes to slanting one axis along the hex diagonal 0 Answers
Find centres of the sides of a Hexagonal Mesh in UnityScript? Possible? 1 Answer
Why vertex positions appear (0.0, 0.0, 0.0) ? 1 Answer
Vertex colours not blending across triangle face 1 Answer
minimize vertex artifacting for procedural mesh manipulations - vertex collision same object? 0 Answers