Geometry invisible if (0/0/0) corner not visible

I am currently at my first JME project ever, trying to do a very basic civ like game (and learning how to use the engine while doing so).



First I tried to create the terrain out of thousands of quads, each representing a field. Learned that geometry count is bad, too.

To battle that, I tried to just use GeometryBatchFactory.mergeGeometries to merge all the geometries according to their field type, down from ~10k geometries to 7 :D.

But now I got the next problem, as soon as the (0/0/0) corner of one of those new geometries is not in the screen, the geometry completly disappears from the screen. (cam starts at (0/0/20), looking to (0/0/0), only strategy game like movement possible)



I don’t remember having that problem with the premade-quad-mesh geometries, so I expect I just need to add something to my GeometryBatchFactory meshes to make them stay visible, but what?

I think it has to do something with the cam culling. If an object is just slightly not in the cams view, the whole object gets not displayed.

Hope that helps

The bounding volume of the model is not updated properly, which it should be… Do you just use the GeometryBatchFactory? If yes we might have to change it. For now, try using a geometry.updateModeBound()

Thats the code I use to merge the single fields. “FeldTyp” is the enum I use to safe all the data for the field types (name, colour, arraylist of fields using that field type)



[java]for(Feldtyp f : Feldtyp.values()){

if(f.array.size() > 0){

Mesh field = new Mesh();

GeometryBatchFactory.mergeGeometries(f.array,field);

Geometry spielfeld = new Geometry(f.name,field);

Material mat = new Material(manager, “Common/MatDefs/Misc/SolidColor.j3md”);

mat.setColor(“m_Color”, f.color);

spielfeld.setMaterial(mat);

spielfeld.setLocalTranslation(0, 0, 0);

Main.felder.attachChild(spielfeld);

}

}[/java]



Adding spielfeld.updateModelBound(); does solve the problem, thanks

Did you try to update the model bounds?

Seems like we need to add a final updateModelBound to the Factory, hm?

It’s working now, thanks