Time for action – I spy with my little ear

In real life, sound can be occluded (behind closed doors in another room) or obstructed (in the same room, but behind the couch).

The audioRenderer of SimpleApplication, however, does not take the scene's walls into account when rendering audio. This means that when you attach audio nodes to a scene, the sound is audible through obstacles. For loud gunshots or ambient sounds in a forest, this may be acceptable. But often, gameplay requires you to hide a sound: you do not want all players to hear the zombies right away—not before they have entered the abandoned warehouse and it's too late.

The sample code given next introduces you to a simple case of directional audio.

  1. Make a copy of PositionalSound.java ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.