Hi, may I ask someone to update the wiki concerning the positional audio and add some comment regarding what happens when the audionode is attached to some node.
I think this topic was raised a few times by others, and now I had issues with this, and I am still not sure about the definite answer.
So, please mention in the wiki that it is not enough to attach the node to the scene, the AudioNode must be updated manually by calling the setPositional(true); method every time the parent node moves.
I found one topic saying that the updateGeometricState() method should be the key, but that did not seem to work.
None of that is true, though. setPositional(true) once and attach it to a node that is attached to the scene. That’s all you need to do. You only have to manually call updateGeometricState() if you don’t want to attach it to the scene.
If this is not the case for you then something else is wrong and that’s where we should start. Positional audio works fine for me in all of the various places that I use it.
What I do is that I have a node, under this node I have 3 nodes.
I move this node, with the velocity vector.
The positional audio has correct world transformation, the listener has correct location, but the audio fades away because the audio position does not change.
So what triggers out the audio update?
I suppose the parent should call updateGeometricState(), because that is the only method calling the audio render update aside from the setters.
I suppose I should use the local translation of the node, but neither the node nor the spatial code does not indicate that it would call the updateGeometricState() in case of localTranslation, instead the transform refresh, and if I look at this correclty, that won’t get back to updateGeometricState().
I am too tired to continue now…
This is the first time i dug into the source code of jMonkey, it is so readable. Big kudos for that!!!
Anyway, I will also try localTranslation on the node and see if the child audio is updated. Using move is the only issue i can think of…
Yes, If I move the listener, I hear the audio position to change. The problem is that the sound location stays in (0,0,0). Actually if I stop the sound and restart it, the sound location updates to the new position, but because the listener moves with the camera, the sound fades away again. My main nood is attached to the scene, and if I keep calling setPosition(true) , all sounds seem to update as expected.
I tried reposition the node with setLocalTranslation, but I still need setPosition(true) to force the audiorender refresh.
Also, I haven’t mentioned this, but I am still on 3.0
Maybe if someone would like to fix this bug (and also the Light cloning bug) for jME 3.0 that would be very cool. Since the code should be in the 3.0 branch on version control system (github) only the publishing part for the homepage of jME and for the SDK update system should be a (little) problem…
That looks like to be the issue. I moved my camera to the world translation of my main node, which wraps together the sound and the models . Also the audio logging has the same affect. I need to revise these parts of my code now…
I should test this out, but I am afraid not. Moreover, even getWorldBound() is effected. My collision code is still in very-very early phase, and I was using this method from the parent node → it also disabled the positional audio.
This sounds to be like an ideal starter task to gain more understanding on the engine, but I am afraid to promise that I can commit myself to this in the next 2 weeks. Is it OK if i add a new issue with this on git?