How to create a disk mesh

Hi there forum people.
Is there anyone on the forum that can help me with creating a disk mesh?

I need a disk type mesh for my game Puzzle Dots.

Disk, like CD, with a hole in the middle, or just a solid cut trough a spere?

Just a flat disk mesh like the side of a cylinder which is closed.

It must have proper UV mappings to a texture as well where the middle of the disk is the middle of the texture.

Alright, give me a few minutes

1 Like

Thanks

Have not tested the texCoordiantes, but in theory it should work…

And the very small “test”

public class DiskTest extends SimpleApplication {
    @Override
    public void simpleInitApp() {
        Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        Geometry disk = new Geometry("Disk", new Disk(10, 1));
        disk.setMaterial(material);
        material.setColor("Color", ColorRGBA.Red);
        material.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
        rootNode.attachChild(disk);
    }

    public static void main(String[] args) {
        new DiskTest().start();
    }
}

Had the indices reversed. This is the correct ordering:

Thanks @zzuegg it works.
The only thing that doesn’t work is the UV coords.

I see, have to play around a bit

Cool and thanks again.

Missed to generate the texCoords for the 0 vector.

Add the line

vertexTexCoordinates[0] = new Vector2f(0.5f, 0.5f);

after

vertexPositions[0] = new Vector3f(); //Center 

Thanks it works like a charm.