Invisible Cylinder

Hi! I know this must be a very stupid question since I couldn’t find an answer myself in the forum, but stil… As you can easily guess, I’m a total noob jme-wise so please forgive me!

I tried to get a cylinder in my simpleInitApp function, this way:

[java]
Cylinder cylinder = new Cylinder(10, 10, 1, 1);
Geometry geoCylinder = new Geometry(“Cylinder”, cylinder);
Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setColor(“Color”, ColorRGBA.White);
geoCylinder.setMaterial(mat);

rootNode.attachChild(geoCylinder);
[/java]

…but nothing happens. No cylinder is rendered. Why?
Thank you for reading my question!

Is your initial camery maybee inside the cylinder? as it is a 0,0,0 where the cam starts as well.

I tried to move the camera further from the center but still I can’t see the cylinder…

The code looks fine. Not that much different than the basic game code you start with. So the problem is somewhere else.

Make a simple test case illustrating the issue and then when that works you can go back and figure out what’s different about your version that doesn’t work.

It works fine with a Box (same code, just slightly adjusted to fit the Box’s constructor’s requirements). Actually, it is a test case: I was trying to draw a cylinder just for the sake of it, in order to practice with the API - and then add cylinders in another program.
The rest of the code wouldn’t even deserve to be mentioned: class and main function, that’s it. Could you please compile it and let me know if it works for you?

The cylinder has a radius of 10 and afaik the initial cam position is lower than 10, I think Empire had it right.

Got it! The construtor that you are using doesn’t make a face at the end of the cylinder. Use this construtor instead:

[java]Cylinder cylinder = new Cylinder(10, 10, 1, 1, true);[/java]

This construtor will now make a face at the end of the cylinder. Hope it works :wink:

@Ev1lbl0w said: Got it! The construtor that you are using doesn't make a face at the end of the cylinder. Use this construtor instead:

[java]Cylinder cylinder = new Cylinder(10, 10, 1, 1, true);[/java]

This construtor will now make a face at the end of the cylinder. Hope it works :wink:

Ah, that did it! Thank you very much!