Time for action – underwater

Do you remember the beautiful underwater effects that we recently discussed, with waves and sunbeams? You can increase the immersion of an underwater scene by dampening all sounds while the camera is under water.

  1. Make a copy of WaterTerrainSky.java and name the class UnderWaterAudio.java. Remember to also refactor the first line of the main() method to UnderWaterAudioapp = new UnderWaterAudio();.
  2. Keep all code of the water-terrain-sky simulation.
  3. Add the following class fields for the audio node and the environmental effect:
    private AudioNode wavesAudio;
    private LowPassFilter underWaterAudioFilter = new LowPassFilter(0.5f, 0.1f);
    private LowPassFilter aboveWaterAudioFilter = new LowPassFilter(1f, 1f);
  4. Create a Boolean class ...

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.