I have a CAR pawn with a few UAudiocomponents:
I want to control the engine pitch and ambience sound pitch and volume related
with the speed of the car.
Thing is that it’s working on the server-client only and not in the client side.
I am using a timer inside the pawn defined in BeginPlay():
GetWorldTimerManager().SetTimer(enginSoundHandle,this,&ACar_CPP::myEngineSound,.1f,true);
implementation:
void ACar_CPP::myEngineSound()
{
float newPitchMult = UKismetMathLibrary::MapRangeClamped(
ChaosMovementComponent->GetEngineRotationSpeed(),1200.f,4000.f,.5f,1.5f);
if (myCarEngineSound) myCarEngineSound->SetPitchMultiplier(newPitchMult);
if (mySfxAmbience)
{
const float newVolMult = UKismetMathLibrary::MapRangeClamped(
getForwardSpeed(),800.f,3000.f,0.f,1.f);
newPitchMult = UKismetMathLibrary::MapRangeClamped(
getForwardSpeed(),800.f,3000.f,.5f,1.f);
mySfxAmbience->SetVolumeMultiplier(newVolMult);
mySfxAmbience->SetPitchMultiplier(newPitchMult);
}
}
I repeat. works perfect on the player that runs the server only.
Volume and pitch changes are not happening on the client-only players.
Any help?
Thanks!
Dany