Time for action – finding stuff in the scene graph

When you create effects in the SDK, you can add several spatials to one .j3o file. For a campfire, you would add one fire emitter, one smoke emitter, and some wooden logs geometries. After loading the scene, you may want to change the effect properties inside the loaded scene, but how do you access, say, the fire emitter, without a variable?

Use the following approach to find any spatial anywhere in your scene graph:

  1. Make a copy of Main.java and name the class LoadEffectFromJ3o.java. Remember to also refactor the first line of the main() method to LoadEffectFromJ3o app = new LoadEffectFromJ3o();.
  2. Load the .j3o file containing your effect in the simpleInitApp() method, using assetManager, and attach ...

Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.