Game Development Reference
In-Depth Information
There's more
The recipe has covered playing audio originating from the player. It is almost as easy doing
this for other entities in the scene. Since
AudioNode
extends
Node
, it has a position in
the scene graph. Attaching an
AudioNode
instance to the scene graph will play the sound
using its
worldTranslation
field, just like how a model will be shown at that location.
Apart from setting
localTranslation
, we also need to make sure that the positional
Boolean in
AudioNode
is
true
(which it is by default). We're also only allowed to use
mono channel sounds when using positional audio.