Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How inscribe a regular hexagon in an irregular hexagon socket ?

Discussion in 'Editor & General Support' started by Rekyem, Feb 28, 2016.

  1. Rekyem

    Rekyem

    Joined:
    Jun 23, 2014
    Posts:
    13
    Hello !

    Following this question, I have make my geodesic sphere :) :
    (I followed a tutorial, and this sphere is obtained by subdivise an icosahedron)
    hexagonalGeodesic.png
    (The left view is orthogonal).

    Now I want inscribe my (regular) hexagon mesh in the different (irregular) hexagon socket, like this :
    (I make these screens with a manual modification, in Unity scene view)
    hexaSuperposition.png
    (The views are orthogonal).

    Currently, the only thing I'm doing correctly is the Y orientation (-y lookat the center of the sphere).

    What I'm missing, to marry my hexagon to his socket is :

    - The X rotation. (Taking into account the -y lookat)
    - The X = Y = Z scale (I don't want deform him).
    - The little X and Z offset position after having done the scale. (Currently is the center of gravity of the socket, but after do the scale, I need to slightly reposition the hexagon).

    I don't know overly, how to take the problem and obtain what I want ... :(

    The variables I have :
    - The transform of my hexagon mesh (and all GameObject properties ... MeshRenderer, MeshFilter ...)
    - The positions (Vector3) of the socket

    Can you help me ???
    Thanks !
     
  2. Rekyem

    Rekyem

    Joined:
    Jun 23, 2014
    Posts:
    13
    I found a solution, for the scale, but the rotation still a problem ...
    I have test many solution, but none is perfect.

    Here my actual result. You can see a offset for the hexagons near of the pentagons.

    In this standalone, for the scale, I use a formule involving the perimeter of the socket, and a lambda multiplicator.
    For the rotation, my X (red arrow of the pivot) look an angle of the socket (the closest when the hexagon mesh is instantiate to the position). But for some hexagons socket, is not a solution. In particular for the hexagons near of the pentagons. (Because, there is a tightening, and areas near the pentagons contain the most irregular hexagons sockets)

    I know that with an regular hexagon I can't have a perfect result, but I want the best solution !

    I'm listening to your solutions !
    Thanks !
     
  3. jamestrue

    jamestrue

    Joined:
    Jan 25, 2017
    Posts:
    5
    I am trying to make your model but getting different results. The link you posted didn't have an answer. Can you elaborate or supply a model?