Improve car sounds

soundtrack
Ensar Sarajčić 2021-11-13 21:12:33 +01:00
parent 4f77026f60
commit 8bd36dddfc
2 changed files with 3 additions and 3 deletions

View File

@ -19,8 +19,8 @@ buffer_length = 1.0
[node name="beetlecar" instance=ExtResource( 2 )]
mass = 140.0
script = ExtResource( 1 )
gear_ratios = [ 2.24, 2.0, 1.89, 1.67, 1.44, 1.23 ]
final_drive = 5.6
gear_ratios = [ 2.95, 2.2, 1.76, 1.43, 1.25, 1.0 ]
final_drive = 5.0
max_rpm = 8000.0
power_curve = SubResource( 3 )
sound_curve = SubResource( 4 )

View File

@ -145,6 +145,6 @@ func _generate_engine_sound(rpm_factor):
var fill_percent = 0.0
while to_fill > 0:
engine_sound_playback.push_frame(Vector2(1.0, 1.0) * factor)
factor += cos(factor) * sin(factor) * (1 + to_fill % 2) * (sound_curve.interpolate_baked(fill_percent) * 2 - 0.5)
factor += cos(factor) * sin(factor) * (1 + to_fill % 2) * ((sound_curve.interpolate_baked(fill_percent) - 0.5) * 2)
to_fill -= 1
fill_percent += fill_segment