[Solved] Creation hexagon mesh

Hi all,

I am trying to create a hexagon mesh for my game. The creation seems to work somehow but it’s not showing anything ingame. :confused:

public class Tile {

    private Mesh mesh;
    private TileType tileType; //TBD
    
    public Tile() {
        initMesh();
    }

    private void initMesh() {
        mesh = new Mesh();
        
        Vector3f[] vertices = new Vector3f[6];
        vertices[0] = new Vector3f(1, 0, 0);
        vertices[1] = new Vector3f(3, 0, 0);
        vertices[2] = new Vector3f(4, 2, 0);
        vertices[3] = new Vector3f(3, 4, 0);
        vertices[4] = new Vector3f(1, 4, 0);
        vertices[5] = new Vector3f(0, 2, 0);

        Vector2f[] texCoord = new Vector2f[6];
        texCoord[0] = new Vector2f(1, 0);
        texCoord[1] = new Vector2f(1, 0);
        texCoord[2] = new Vector2f(1, 1);
        texCoord[3] = new Vector2f(1, 1);
        texCoord[4] = new Vector2f(1, 1);
        texCoord[5] = new Vector2f(0, 1);

        //von unten nach oben
        int[] indexes = {
            2, 0, 1, //1. von unten
            5, 0, 2, //2. von unten
            3, 5, 2, //3. von unten
            4, 5, 3  //4. von unten
        };

        mesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
        mesh.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoord));
        mesh.setBuffer(Type.Index, 3, BufferUtils.createIntBuffer(indexes));
        mesh.updateBound();

        Geometry geo = new Geometry("OurMesh", mesh);
        Material mat = new Material(GameManager.g_assetManager,
                "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Red);
        geo.setMaterial(mat);
        GameManager.g_simpleApplication.getRootNode().attachChild(geo);
    }
}

Post your entire code.
Your code dosent seens to be adding anything on scene.
Missing something like rootNode.attachchild(geo);

That’s the whole code. I am attaching the geo at the last line “GameManager.g_simpleApplication.getRootNode().attachChild(geo);”

What is the GameManager doing?
How is the App started at all? Do you see the initial settings dialog?

The GameManager is the extended class of SimpleApplication. And simply initial stuff like gui, sound, game inputs, camera etc. Which dialog do you mean?

Edit: Found the problem: The camera’s position was wrong… thanks anyway^^