jMonkeyEngine SDK: Sample Code

The JME3Tests Project

The jMonkeyEngine SDK contains a Test Project with lots of sample code and assets. The Test Project is all set up and ready to run, and it's easy to use for beginners (no need to mess with classpaths or libraries).

  1. Open the jMonkeyEngine SDK
  2. Go to File→New Project
  3. In the New Project Wizard, select JME3 Tests from the JME3 category. Click Next.
  4. Specify a location, e.g. the jMonkeyProjects directory in your home directory. Click Finish.

This default project template creates a project called JmeTests. It contains all test classes and examples from the jme3 source repository. Feel free to modify the code samples and experiment! In the unlikely event that you should break the project, :-) you can always recreate all packaged samples from the New Project wizard's JME3 Tests template.

JME3TestData Assets

Here is another tip if you need access to sample assets, such as 3D models or textures, in one of your projects. A common situation for this would be while going through the beginner tutorials.

  1. Right-click your jME3 project, and select Properties
  2. In the Properties window, select the Libraries section. Go to the Compile tab, it contains compile-time libraries.
  3. Click the Add Library… button and select the pre-defined jme3-test-data. Click OK.
  4. Click OK to save and close the Properties.

The project's assetManager now has access to sample files from the jme3-test-data.jar file. This JAR library contains

  • Ogre XML Models: Ninja.mesh.xml, Oto.mesh.xml, HoverTank.mesh.xml, Sinbad.mesh.xml, and many more
  • Blender models
  • Materials and Textures
    • Terrain, sky, rock, brick, pond…
    • Particle effect textures
  • Sounds
  • And more…

AssetPacks

jmonkeyengine.org_wp-content_uploads_2010_10_assetpackbrowser-300x166.jpg If you need sample 3D models, don't miss the opportunity to download our community-provided Asset Packs!

In the SDK:

  • Open the AssetPackBrowser from the Windows menu
  • In the AssetPackBrowser, click the Online AssetPacks button
  • Click install on the AssetPack of your choice. The SDK downloads it and makes the assets accessible in your AssetPack Library.
  • Click the View Library button and open the Assets node.
  • Right-click an asset to
    • Preview it
    • Add it to the SceneComposer
    • Add it to a game project's assets directory

Read more about Asset Packs and how you can share your own collection with the community.

 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution 3.0 Unported