Download

Hexworld/Planet, Vector Math i guess

Hey Guys and Girls,

hope this is the right subforum.

I’m trying to build some kind of a hexplanet. I have hundreds of vertices, hexagons and the 12 pentagons needed to make a sphere.

I know the six vertices that make up every hexagon, spawn the hexagon in the center between those six and resize it. But now i need to rotate them in X, Y and Z to make the corners line up with those six vertices to make it look like a planet.

I’ve already rotated them once along one axis between two of the vertices but as you can see, that wasn’t enough.

I’ve notived that this is kind of where my vector math and experience with unreal runs out and my code to get to this point is already looking like garbage. =)
So maybe someone can give me a hint or solution about how to tackle this best.

Thanks!

I’m not sure if this is a help, but if I were doing this I would approach it from the PoV of normals instead of the axes between the vertices.

Conceptually the normal of each hexagon should match up with the radial line that extends from the center of the sphere to the center-point of the hexagon/pentagon.

I think.

I’d also have to think about it a little more about how to use that desired normal to properly orient the shape. Some of my 3D math skills are also not the best (and I’ve been doing this for 20 years!)

1 Like

If I were to tackle this I would probably look at spawning every hexagon perpedicular to the center of the “planet” at a set distance. That would ensure correct orientation of all the hexagons.

1 Like

didn’t have the time to work on it for a few weeks.

that was it! you guys had the right idea!
so simple… just used the “FindLookAtRotation” from the center of the hexagons to the center of the sphere.

just some resizing to do.