[SOLVED] Positional audio .play() not moving

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.

note: Oh I am using 3.0 not 3.1 - if this was a 3.0 bug and is fixed I apologize for being a dummy.

Note: if your node is not attached to the scene graph then you will have to manually call updateGeometricState() on it or the position will never get updated in the audio layer.

1 Like

Arghhhhhhhhhhhhhhhhhhhh

Swear I tried this

That solved it, thanks peed.

Got hit by this enough times myself that I finally remember now. :slight_smile: