Find centres of the sides of a Hexagonal Mesh in UnityScript? Possible?

Imagine a Hexagonal Mesh. North and South are Horizontal. Is there a way to find the centre of the South East and South West facing edges of a Hexagon Mesh in UnityScript?

Or must I create bones/rigging in 3ds that sits right on those spots?

http://oi52.tinypic.com/141r1uc.jpg

Have a look at the above image link, hopefully this shows the spots I'm trying to find.

Forum Link: heres the same thing in the forum: http://forum.unity3d.com/threads/84024-Finding-midpoints-of-edges-on-a-hexagonal-mesh.

Any screenshots? Because hexagonal is a 2d term so it's the shape but not a volume and a Hexahedron would ba a cube ;). A screendhot that shows your mesh and the spots that you want to find would help. http://en.wikipedia.org/wiki/Hexahedron

1 Answer

1

Are you talking a single hexagon? You can do just about anything with a mesh:

http://unity3d.com/support/documentation/ScriptReference/Mesh.html

So get the edges you need and find their centers I'm guessing. Or the centroid of the whole thing, I'm not sure what you're asking: a value which is the average of those edges or a value for each edge?

Not ordered, and another post here says that they get reordered on import anyway. If this will really be that simple a mesh, you could construct it via script, then you'll know precisely what's what.

Some ideas, none of them do I like: You could make some 'dummy' objects at the points you need, just empty transforms really, children of this object. You could find the center of the thing then Raycast in plane of the hexagon in the heading of the sides you want. Ech! You could construct the entire thing in code, then you know exactly what's what. You could make each side (or the sides you care about) submeshes. Perhaps each with a different material or something to differentiate it.