This page provides a quick answer to the questions "I want my game to do X, where do I find that in jME 3 ??"
Knowing exactly what you are looking for allows you to search more efficiently, find documentation more quickly, and ask clearer questions on the support forum. This intermediate page assumes that you already went through the beginner tutorials. Feel free to add APIs, tutorials and javadoc links that helped you understand and use a feature!
How do I…? | Use this JME 3 Feature! | Learn more here… |
---|---|---|
Start with a preconfigured game | com.jme3.app.SimpleApplication | Hello SimpleApplication |
Make an object appear in the scene | Attach nodes and geometries to the rootNode: rootNode.attachChild(geo); com.jme3.scene.Node, com.jme3.scene.Geometry node.setCullHint(CullHint.Never); | The Scene Graph Hello Asset Hello Node |
Make an object disappear from the scene | Detach nodes and geometries from the rootNode: rootNode.detachChild(geo); node.setCullHint(CullHint.Always); | The Scene Graph Hello Asset Hello Node |
Use third-person view | Use default camera cam com.jme3.renderer.Camera | ChaseCam WIP |
Use first-person view | Use camera flyCam com.jme3.input.FlyByCamera | Hello Collision |
Increase camera speed | flyCam.setMoveSpeed(50f); | – |
Only draw outline of the scene | Use a wireframe material, e.g. for debugging. | Debugging |
Change the background color | Call viewPort.setBackgroundColor(ColorRGBA.Blue); | N/A |
Customize the applicaton class | Extend com.jme3.app.SimpleApplication (or com.jme3.app.Application) and set Application Settings | SimpleApplication AppSettings |
Disable the logger output | Logger.getLogger("").setLevel(Level.SEVERE); java.util.logging.* | Logging |
How do I…? | Use this JME 3 Feature! | Learn more here… |
---|---|---|
Make simple shapes like cubes, spheres | com.jme3.scene.Geometry, com.jme3.scene.shape.* | Hello Node, Shape TestCylinder.java, TestBox.java, TestSphere.java |
Create a 3-D model | Create the model in a 3-D mesh editor (for example Blender) and export it as Ogre XML mesh. | Download Blender, Blender tutorial, Blender-to-Ogre plugin 3D Models |
Load a 3-D model | Import asset as Ogre XML mesh. jMonkeyPlatform: Converting Ogre to j3o binary format speeds up model loading. AssetManager, com.jme3.scene.plugins.ogre.*, com.jme3.scene.Geometry | Hello Asset jMonkeyPlatform j3o converter TestOgreLoading.java, TestOgreConvert.java |
Move or turn or resize an object | Use transformations: geo.setLocalTranslation(), geo.rotate(), geo.scale() geo.updateGeometricState(); | Hello Node Spatial |
Concatenate transformations (e.g. rotations around several axes in one step) | com.jme3.math.Quaternion, slerp() com.jme3.math.Transform, interpolateTransforms() | rotate, rotate_about_a_point, quaternion, math_for_dummies |
Make an object move by itself | Change the geo's translation in the update phase of the main loop. Or remote-control the motion using cinematics. com.jme3.scene.Geometry, setLocalTranslation(), setWalkDirection() for physical objects. | Hello Loop Update Loop Custom Controls Cinematics TestBumpModel.java, TestOgreLoading.java |
Manipulate the color or shininess of an object | Materials, AssetManager | Hello Material Materials Overview TestNormalMapping.java, TestSphere.java |
Manipulate the surface of an object (wood vs stone vs metal etc) | Textures, AssetManager. | Hello Material Materials Overview TestSimpleBumps.java Blender: Creating Bump Maps and Normal maps |
Make objects cast a shadow | com.jme3.shadow.BasicShadowRenderer, com.jme3.light.DirectionalLight setShadowMode() | Light and Shadow TestEverything.java, TestShadow.java |
Render transparent objects (glass, window panes, water, tree leaves) | Assign a transparent texture to the Material and set material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); | Hello Material Materials Overview |
Force or disable Backface culling | com.jme3.material.RenderState.FaceCullMode: Back, Front, FrontAndBack, Off e.g. material.getAdditionalRenderState(). setFaceCullMode(FaceCullMode.FrontAndBack); | N/A |
Make procedural or custom shapes | com.jme3.scene.Mesh | Custom Meshes |
Keep my models, textures, sound files in order | Put all assets in subdirectories of a project directory named assets and use the assetManager to load them. | Hello Asset, Asset Manager |
Identify Named Sub-Mesh in Model | Geometry result = spatial.getName().startsWith(name); | Spatial |
How do I…? | Use this JME 3 Feature! | Learn more here… |
---|---|---|
Implement the game logic and game mechanics | Use Controls to define behaviours of types of Spatials. Use Application States to implement global behaviours. Use the simpleUpdate() loop for the remaining tests and interactions. Use Cinematics to remote-control objects in scenes. | Hello Loop Update Loop Custom Controls Application States Cinematics |
Let players interact by pressing keyboard keys | com.jme3.input.KeyInput, com.jme3.input.binding.BindingListener | Hello Input Input Handling |
Let players interact by clicking, e.g. picking up objects, opening doors, shooting | Intersect a Ray from the player with the Bounding Volume of the target: com.jme3.bounding.*, com.jme3.math.Ray, com.jme3.collision.CollisionResults. | Hello Picking Collision and Intersection TestRayCollision.java |
Animate objects and characters | Create an animated OgreMesh model with Bones in a 3-D editor (e.g. Blender). com.jme3.animation.* | Hello Animation Animation animation, Blender animation tutorial |
Keep players walking on floors of scenes | Collision detection – raycasting or physics. | Hello Collision Physics |
Prevent players from walking through walls in scenes | Collision detection using physics and bounding volumes. com.jme3.bullet.*, CapsuleCollisionShape / CompoundCollisionShape, PhysicsCharacterNode / PhysicsNode geo.setModelBound(); geo.updateModelBound(); | Hello Collision Physics |
Let balls, cars, etc bounce off obstacles and roll on floors | Use physics nodes and bounding volumes: com.jme3.bounding.*, com.jme3.bullet.collisions, com.jme3.bullet.nodes.PhysicsNode etc geo.setModelBound(); geo.updateModelBound(); | Hello Physics Physics TestSimplePhysics.java, more samples |
Steer cars, motorcycles, etc | Use physics characters and vehicles: com.jme3.bullet.*, PhysicsCharacterNode, PhysicsVehicleNode | Vehicles TestFancyCar.java, TestPhysicsCharacter.java (Press HUJK keys to steer, spacebar to jump.) |
Let an object swing like a pendulum or chain links | Use physics joints: com.jme3.bullet.joints.PhysicsHingeJoint | Hinges and Joints TestPhysicsHingeJoint.java (Press HK keys to turn, spacebar to swing.) |
How do I…? | Use this JME 3 Feature! | Learn more here… |
---|---|---|
Get rid of default debug display (fps, stats etc) in SimpleApplication | app.setDisplayFps(false); app.setDisplayStatView(false); | N/A |
Display text (score, health), flat mini-maps or status icons | Attach a picture to the orthogonal guiNode to create a heads-up display (HUD). com.jme3.font.*, com.jme3.ui.Picture. guiNode.attachChild() | HUD TestOrtho.java, TestBitmapFont.java |
Display buttons to let the player switch between the game/settings/score screens | Nifty GUI | Nifty GUI TestNiftyGui.java |
How do I…? | Use this JME 3 Feature! | Learn more here… |
---|---|---|
Play sounds and noises | AudioRenderer, Listener, and AudioNode from com.jme3.audio.* | Hello Audio Audio audio |
Simulate fire, flames, smoke, explosions, swarms, dust, magic spells | Use particle emitters: com.jme3.effect.EmitterSphereShape, com.jme3.effect.ParticleEmitter | Hello Effects Particle Emitters Bloom and Glow Effects Overview TestExplosionEffect.java, TestParticleEmitter.java |
Simulate water, waves, reflections | com.jme3.water.* | Water Post-Processor Water TestSceneWater.java |
Generate a terrain | com.jme3.terrain.* | Hello Terrain Terrain TestTerrain.java |
Simulate a sky | rootNode.attachChild(SkyFactory.createSky( assetManager, "Textures/Sky/Bright/BrightSky.dds", false)); skyGeo.setQueueBucket(Bucket.Sky) | Sky TestCubeMap.java |
How do I…? | Use this JME 3 Feature! | Learn more here… |
---|---|---|
Check graphic card capabilities | com.jme3.renderer.Caps Collection<Caps> caps = renderer.getCaps(); Logger.getLogger(HelloJME3.class.getName()).log(Level.INFO, "Caps: {0}" + caps.toString()); | N/A |
Optimize the heck out of the scenegraph | jme3tools.optimize.GeometryBatchFactory GeometryBatchFactory.optimize(rootNode); | N/A |