O'Reilly logo

jMonkeyEngine 3.0 Beginner's Guide by Ruth Kusterer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required