We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 99f6e67 + bded14a commit e691f98Copy full SHA for e691f98
3d/truck_town/vehicle.gd
@@ -10,6 +10,8 @@ var steer_target = 0
10
export var engine_force_value = 40
11
12
func _physics_process(delta):
13
+ var fwd_mps = transform.basis.xform_inv(linear_velocity).x
14
+
15
if Input.is_action_pressed("ui_left"):
16
steer_target = STEER_LIMIT
17
elif Input.is_action_pressed("ui_right"):
@@ -23,7 +25,10 @@ func _physics_process(delta):
23
25
engine_force = 0
24
26
27
if Input.is_action_pressed("ui_down"):
- brake = 1
28
+ if (fwd_mps >= -1):
29
+ engine_force = -engine_force_value
30
+ else:
31
+ brake = 1
32
else:
33
brake = 0.0
34
0 commit comments