The simplest type of Meshes are the built-in JME Shapes. You can create Shapes without using the AssetManager.
Do not mix up these visible Shapes with similarly named classes from the maths package. Choose the right package when letting your IDE fill in the import statements!
These maths objects are invisible and are used for collision testing (ray casting) or to describe motion paths. They cannot be wrapped into a Geometry.
To add a shape to the scene:
You can compose more complex custom Geometries out of simple Shapes. Think of the buildings in games like Angry Birds, or the building blocks in Second Life ("prims") and in Tetris ("Tetrominos").
setLocalTranslation()
) so that the Node is in the center of the new constellation. The central Node is the pivot point for transformations (move/scale/rotate).
The order is important: First arrange around origin, then transform. Otherwise, transformations are applied around the wrong center (pivot). Of course, you can attach your constellation to other pivot Nodes to create even more complex shapes (a chair, a furnished room, a house, a city, …), but again, arrange them around the origin first before you transform them.
Note: Obviously, these composed Geometries are simpler than hand-sculpted meshes from a mesh editor.
Sphere mesh = new Sphere(32, 32, 10, false, true);
Dome mesh = new Dome(Vector3f.ZERO, 2, 4, 1f,false); // Pyramid
Dome mesh = new Dome(Vector3f.ZERO, 2, 32, 1f,false); // Cone
Dome mesh = new Dome(Vector3f.ZERO, 32, 32, 1f,false); // Small hemisphere
Dome mesh = new Dome(Vector3f.ZERO, 32, 32, 1000f,true); // SkyDome
PQTorus mesh = new PQTorus(5,3, 2f, 1f, 32, 32); // Spiral torus
PQTorus mesh = new PQTorus(3,8, 2f, 1f, 32, 32); // Flower torus
Use one of the above examples together with the following geometry in a scene:
Geometry geom = new Geometry("A shape", mesh); Material mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md"); geom.setMaterial(mat); rootNode.attachChild(geom);