Add basic downforce and drag

pull/2/head
Ensar Sarajčić 2022-01-24 15:33:00 +01:00
parent af62cdbafe
commit 0a71908bc9
4 changed files with 19 additions and 5 deletions

View File

@ -49,10 +49,12 @@ rings = 3
mass = 850.0
script = ExtResource( 1 )
max_steer_input = 35.0
max_engine_force = 400.0
max_engine_force = 450.0
max_brake_force = 90.0
base_engine_pitch = 0.38
expected_max_speed = 170.0
drag_factor = 1.55
downforce_factor = -0.2
gear_ratios = [ 2.99, 2.5, 1.98, 1.56, 1.32, 1.12 ]
final_drive = 4.0
max_rpm = 8000.0

View File

@ -52,6 +52,8 @@ max_brake_force = 220.0
throttle_power = 10000.0
max_rpm_loss_ps = 4000.0
base_engine_pitch = 0.45
drag_factor = 1.65
downforce_factor = 1.1
gear_ratios = [ 3.8, 2.7, 2.2, 1.75, 1.4, 1.2 ]
power_curve = SubResource( 2 )
sound_curve = SubResource( 4 )

View File

@ -60,6 +60,8 @@ max_brake_force = 230.0
throttle_power = 8000.0
max_rpm_loss_ps = 2200.0
base_engine_pitch = 0.65
drag_factor = 0.85
downforce_factor = 1.8
gear_ratios = [ 3.5, 2.95, 2.64, 2.0, 1.67, 1.42 ]
final_drive = 4.36
max_rpm = 9000.0
@ -82,9 +84,9 @@ use_as_steering = true
wheel_radius = 0.35
wheel_rest_length = 0.45
wheel_friction_slip = 7.0
suspension_travel = 0.45
suspension_travel = 0.3
suspension_stiffness = 12.0
suspension_max_force = 7000.0
suspension_max_force = 9000.0
damping_compression = 0.9
damping_relaxation = 0.92
@ -113,9 +115,9 @@ use_as_steering = true
wheel_radius = 0.35
wheel_rest_length = 0.45
wheel_friction_slip = 7.0
suspension_travel = 0.45
suspension_travel = 0.3
suspension_stiffness = 12.0
suspension_max_force = 7000.0
suspension_max_force = 9000.0
damping_compression = 0.9
damping_relaxation = 0.92

View File

@ -21,6 +21,9 @@ export(float) var max_rpm_loss_ps = 3000.0
export(float) var base_engine_pitch = 0.5
export(float) var expected_max_speed = 200
export(float) var drag_factor = 1.0
export(float) var downforce_factor = 1.0
export(Array) var gear_ratios = [3.4, 2.5, 2.0, 1.5, 1.25]
export(float) var reverse_ratio = -3
export(float) var final_drive = 3.45
@ -201,6 +204,11 @@ func _physics_process(delta: float):
if throttle == 0.0 and linear_velocity.length() < 1:
clutch_position = 1
apply_central_impulse(linear_velocity * -1 * drag_factor)
apply_central_impulse(
linear_velocity.length() * -1 * global_transform.basis.y * downforce_factor
)
if gear_timer > 0:
clutch_position = 1
throttle = 0