#include <ProximityChatBPLib.h>
|
| static float | CalculateVoiceAttenuation (const FVector &SpeakerLocation, const FVector &ListenerLocation, float MaxDistance, float VolumeAtMaxDistance) |
| |
◆ CalculateVoiceAttenuation()
| float UProximityChatBPLib::CalculateVoiceAttenuation |
( |
const FVector & | SpeakerLocation, |
|
|
const FVector & | ListenerLocation, |
|
|
float | MaxDistance, |
|
|
float | VolumeAtMaxDistance ) |
|
static |
8{
9
10 float Distance = FVector::Distance(SpeakerLocation, ListenerLocation);
11
12 if(Distance > MaxDistance)
13 {
14
15 return 0.0f;
16 }
17
18 const float AttenuationFactor = 1.0f - (Distance / MaxDistance);
19
20
21 const float VoiceVolume = FMath::Lerp(VolumeAtMaxDistance, 1.0f, AttenuationFactor);
22 return VoiceVolume;
23
24
25}
The documentation for this class was generated from the following files:
- T:/Unreal/Unreal Projects/SpaceAdventure52/SpaceAdventure/Plugins/MenuSystem/Source/MenuSystem/Public/ProximityChat/ProximityChatBPLib.h
- T:/Unreal/Unreal Projects/SpaceAdventure52/SpaceAdventure/Plugins/MenuSystem/Source/MenuSystem/Private/ProximityChat/ProximityChatBPLib.cpp