I have a level where the player watches animations that are across the hall from each other. However because the sound is played at the camera location the wrong sound is playing. I want the ambient sound to be played based on the location of the player mesh or capsule instead of the camera. Is there a way to do this?
Anyone else have this issue?
I picked up the answer at this forum post: Sound Pickup Based On Pawn Not Camera - Cinematics & Media - Unreal Engine Forums
Basically, it can be done in C++ as it is not exposed in Blueprints. You must override the virtual function GetAudioListenerPosition()
My own implementation goes like this:
void ADialoguesPlayerController::GetAudioListenerPosition(FVector & OutLocation, FVector & OutFrontDir, FVector & OutRightDir)
{
OutLocation = GetPawn()->GetActorLocation();
OutFrontDir = GetPawn()->GetActorForwardVector();
OutRightDir = GetPawn()->GetActorRightVector();
}
Thank you so much!! I am working on learning C++ but like many non programmers I am stuck with Blueprint until I learn more about how to implement code.
I figured out where to find the code and replaced it with the code above in Visual Studio and saved it. I didn’t get any errors but not sure if I compiled or even needed to compile. I restarted the project. However, it still didn’t update where the sound is played. I don’t have a dialogue player just have a volume inside a room. Any advice?