How to get second AudioComponent to play where the actor is located?

I have an actor that doesn’t move. I have a second AudioComponent on it and I have enabled attenuation. When I play audio with the second AudioComponent, it doesn’t play from where the actor is physically located. It seems to play from (0,0,0). The first AudioComponent works fine. I sometimes need to play 2 audio clips at the same time and need to have access to the parameters for cross fading on each.

Is there a way to use two AudioComponents short of creating another actor?

I did this and it worked fine, how are you doing it?

I’m setting it up in C++, but I think I may have found the problem. When I added the AudioComponent, I just used CreateDefaultSubobject. I just opened up my blueprint and it replaced the root component. So the second AudioComponent is also a root component.

I’d like to have the audio components as children of the root component. Gotta figure out how to do that.

1 Like

I just needed to add this to my constructor:

RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));

After creating the AudioComponent, you just call

AudioComponent->SetAttachment(RootComponent);

It now works properly.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.