Skip to content

Commit 5f52b34

Browse files
committed
Take into account also distance from camera to car
1 parent 34f8857 commit 5f52b34

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/RunActivity/Viewer3D/Sound.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,15 +494,17 @@ public class SoundSource : SoundSourceBase
494494
{
495495
/// <summary>
496496
/// Squared cutoff distance. No sound is audible above that, except for the actual player train,
497-
/// where cutoff occurs at a distance wich is higher than the train length
497+
/// where cutoff occurs at a distance wich is higher than the train length plus offset to
498+
/// approximately take into account distance from camera to car
498499
/// </summary>
499500
private int CutOffDistanceM2
500501
{
501502
get
502503
{
503504
const int staticDistanceM2 = 4000000;
504505
var isPlayer = Car?.Train?.IsActualPlayerTrain ?? false;
505-
return (int)Math.Max(staticDistanceM2, isPlayer ? Car.Train.Length * Car.Train.Length : 0);
506+
var correctedLength = isPlayer ? Car.Train.Length + 50 : 0;
507+
return (int)Math.Max(staticDistanceM2, correctedLength * correctedLength);
506508
}
507509
}
508510
/// <summary>

0 commit comments

Comments
 (0)