Models and Scenes¶
Model assets
Example .glb paths refer to assets in your project. Replace them with your own model paths and adjust transforms as needed.
Like Shapes, 3D models are also made up of Meshes, but models are more complex than Shapes. While Shapes are built into jME3, you typically create models in external 3D Mesh Editors.
Using Models and Scenes with jME3¶
To use 3D models in a jME3 application:
-
Export the 3D model using a Supported External File Type.
-
Save the files under your project's resource root, for example
game-assets/src/main/assets/Models/in a project generated by the Initializer. Preserve the relative paths of any external files. -
In your code, you use the Asset Manager to load models as Spatials into a jME application.
Spatial model = assetManager.loadModel( "Models/MonkeyHead/MonkeyHead.glb" );
Note
Include the glTF loader from jme3-plugins and supply an actual model at the example path. A release can package glTF directly; conversion to .j3o is optional.
Creating Models and Scenes¶
To create 3D models and scenes, you need a 3D Mesh Editor such as Blender.
Tip
Learn how to create UV textures for more complex models, it looks more professional.
3D model editors are third-party products, so please consult their documentation for instructions how to use them. Here is an example workflow for Blender users: