Hi everyone
I have been using positional audio and the
.playInstance()
To successfully create footsteps, all works beautifully.
I also added a “clothing” noise that plays as the character walks. It is a sound that is looped, and is positional. The only difference between it and my footstep noise is that for this looping sound I use .play() instead of .playInstance(). This sound does not move when I change its translation.
Am I right in thinking you can move sounds whilst they are being played?
Here is my creation code for my AudioNode
gear = new AudioNode(game.assetManager, "Sounds/effects/gear1.ogg");
gear.setReverbEnabled(false);
gear.setRefDistance(10);
gear.setLooping(true);
gear.setVolume(0.5f);
gear.setPositional(true);
Then in simpleUpdate
gear.setLocalTranslation(player.getLocalTranslation());
Then when my character moves
if(gear.getStatus() != AudioSource.Status.Playing)//play gear sound
{
gear.play();
}
As expected it plays when I move, and loops until I stop moving. The problem is that the position of the sound is not changing audibly as he moves. To clarify
-Camera wise I can fly around and hear the sound changing relative to the camera
-The source of the sound however does not change
When I stop my character from moving
gear.stop();
Stops the sound, and if I start moving again the sound will now play from the position the player is in when it begins, but won’t change till I stop again.
I have tried printing out the position of the gear Audio Node and it is changing as my character walks. I noticed some discussion about this here: Question concerning positional audionode - #52 by pspeed
Does anyone have working positional audio that does not use .playInstance()? I am sure I am doing something wrong but I can’t figure out what.