Files
godot-demo-projects/3d/truck_town/vehicles/tow_truck.tscn
Hugo Locurcio cdbdbac1e7 Add mobile controls and optimized settings to Truck Town
On mobile platforms, the vehicle automatically accelerates.
Touch the left and right edges of the screen to steer.
Touch the middle of the screen to brake/reverse
(this also temporarily stops acceleration).

- Fix braking not working correctly (and make breaking stronger
  to make vehicles easier to control at high speeds).
- Allow using the D-Pad for steering and X/Square for braking.
- Tweak exhaust particles to be more subtle and fade more smoothly.
- Change spawn position to a location that's more straightforward
  to drive.
2023-11-17 20:11:31 +01:00

406 lines
14 KiB
Plaintext

[gd_scene load_steps=28 format=3 uid="uid://bh7765vrq5muf"]
[ext_resource type="Script" path="res://vehicles/vehicle.gd" id="1_qhfnb"]
[ext_resource type="ArrayMesh" uid="uid://bqrwin8ccgptt" path="res://vehicles/meshes/wheel.res" id="2_uwuq1"]
[ext_resource type="ArrayMesh" uid="uid://cbpqxxd14g8un" path="res://vehicles/meshes/tow_truck.res" id="3_tv0o3"]
[ext_resource type="Script" path="res://vehicles/follow_camera.gd" id="4_wddne"]
[ext_resource type="ArrayMesh" uid="uid://ctglc27jx8xe2" path="res://vehicles/meshes/truck_cab.res" id="5_04cnp"]
[ext_resource type="AudioStream" uid="uid://cb7wvsd6vygd3" path="res://vehicles/engine.wav" id="5_fwfew"]
[ext_resource type="AudioStream" uid="uid://sy2li7u35867" path="res://vehicles/impact_1.wav" id="6_i7k5m"]
[ext_resource type="AudioStream" uid="uid://bf0h7s81yr8nj" path="res://vehicles/impact_2.wav" id="7_hc8k7"]
[ext_resource type="AudioStream" uid="uid://sun2n8a4xapl" path="res://vehicles/impact_3.wav" id="8_cbgcu"]
[ext_resource type="AudioStream" uid="uid://dpbayeeufya21" path="res://vehicles/impact_4.wav" id="9_y8ei3"]
[ext_resource type="Texture2D" uid="uid://d4ostmqwgytk" path="res://vehicles/particle_smoke.png" id="10_lfosv"]
[ext_resource type="Texture2D" uid="uid://bju75l2w3r7vq" path="res://vehicles/blob_shadow.png" id="11_5ul8v"]
[sub_resource type="BoxShape3D" id="BoxShape3D_0hbge"]
size = Vector3(1.17624, 0.6963, 2.23996)
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_aad58"]
streams_count = 4
random_pitch = 1.05
random_volume_offset_db = 2.0
stream_0/stream = ExtResource("6_i7k5m")
stream_0/weight = 1.0
stream_1/stream = ExtResource("7_hc8k7")
stream_1/weight = 1.0
stream_2/stream = ExtResource("8_cbgcu")
stream_2/weight = 1.0
stream_3/stream = ExtResource("9_y8ei3")
stream_3/weight = 1.0
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_atib4"]
transparency = 1
shading_mode = 0
vertex_color_use_as_albedo = true
albedo_color = Color(0.462745, 0.462745, 0.462745, 0.501961)
albedo_texture = ExtResource("10_lfosv")
billboard_mode = 3
billboard_keep_scale = true
particles_anim_h_frames = 1
particles_anim_v_frames = 1
particles_anim_loop = false
proximity_fade_enabled = true
proximity_fade_distance = 0.5
[sub_resource type="QuadMesh" id="QuadMesh_xsbig"]
material = SubResource("StandardMaterial3D_atib4")
[sub_resource type="Curve" id="Curve_kr6si"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="Gradient" id="Gradient_38b5g"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_i2aww"]
radius = 0.05
height = 0.42
radial_segments = 12
rings = 3
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nrety"]
albedo_color = Color(0.635294, 0.635294, 0.635294, 1)
metallic = 1.0
roughness = 0.5
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eoojf"]
radius = 0.05
height = 0.3
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_so248"]
albedo_color = Color(0.635294, 0.635294, 0.635294, 1)
metallic = 1.0
roughness = 0.5
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_c2qj1"]
albedo_color = Color(0.635294, 0.635294, 0.635294, 1)
metallic = 1.0
roughness = 0.5
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ffy5m"]
albedo_color = Color(0.635294, 0.635294, 0.635294, 1)
metallic = 1.0
roughness = 0.5
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_l1evv"]
albedo_color = Color(0.635294, 0.635294, 0.635294, 1)
metallic = 1.0
roughness = 0.5
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_hvgqm"]
friction = 0.5
[sub_resource type="BoxShape3D" id="BoxShape3D_hbuqf"]
size = Vector3(0.954078, 1, 2.32662)
[node name="TowTruck" type="Node3D"]
[node name="Body" type="VehicleBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00169557, 0.222867, -0.0955184)
center_of_mass_mode = 1
script = ExtResource("1_qhfnb")
[node name="Wheel1" type="VehicleWheel3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.573678, 0.000773743, 1.10416)
use_as_traction = true
use_as_steering = true
wheel_roll_influence = 0.4
wheel_radius = 0.18
wheel_friction_slip = 1.0
suspension_stiffness = 30.0
damping_compression = 0.88
[node name="Wheel1" type="MeshInstance3D" parent="Body/Wheel1"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Wheel2" type="VehicleWheel3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.573678, 0.000773743, -0.783403)
use_as_traction = true
wheel_roll_influence = 0.4
wheel_radius = 0.18
wheel_friction_slip = 1.0
suspension_stiffness = 30.0
damping_compression = 0.88
[node name="Wheel2" type="MeshInstance3D" parent="Body/Wheel2"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Wheel3" type="VehicleWheel3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.573678, 0.000773743, 1.10416)
use_as_traction = true
use_as_steering = true
wheel_roll_influence = 0.4
wheel_radius = 0.18
wheel_friction_slip = 1.0
suspension_stiffness = 30.0
damping_compression = 0.88
[node name="Wheel3" type="MeshInstance3D" parent="Body/Wheel3"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Wheel4" type="VehicleWheel3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.573678, 0.000773743, -0.783403)
use_as_traction = true
wheel_roll_influence = 0.4
wheel_radius = 0.18
wheel_friction_slip = 1.0
suspension_stiffness = 30.0
damping_compression = 0.88
[node name="Wheel4" type="MeshInstance3D" parent="Body/Wheel4"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Body" type="MeshInstance3D" parent="Body"]
layers = 2
gi_mode = 2
mesh = ExtResource("3_tv0o3")
[node name="CameraBase" type="Node3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.97449, 0)
[node name="Camera3D" type="Camera3D" parent="Body/CameraBase"]
transform = Transform3D(-1, 2.11495e-08, -8.48259e-08, 0, 0.970296, 0.241922, 8.74227e-08, 0.241922, -0.970295, 0, 2.032, -4.394)
current = true
fov = 74.0
near = 0.1
script = ExtResource("4_wddne")
min_distance = 5.0
max_distance = 7.0
height = 1.75
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.391365, 0.158069)
shape = SubResource("BoxShape3D_0hbge")
[node name="EngineSound" type="AudioStreamPlayer3D" parent="Body"]
stream = ExtResource("5_fwfew")
pitch_scale = 0.05
autoplay = true
attenuation_filter_cutoff_hz = 20500.0
[node name="ImpactSound" type="AudioStreamPlayer3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.391365, 0.158069)
stream = SubResource("AudioStreamRandomizer_aad58")
volume_db = -9.0
max_polyphony = 3
attenuation_filter_cutoff_hz = 20500.0
[node name="CPUParticles3D" type="CPUParticles3D" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.201696, -0.022867, -1.10448)
amount = 125
lifetime = 1.25
mesh = SubResource("QuadMesh_xsbig")
direction = Vector3(0, 1, -0.5)
gravity = Vector3(0, 0, 0)
initial_velocity_min = 1.0
initial_velocity_max = 1.0
damping_min = 0.05
damping_max = 0.05
angle_max = 360.0
scale_amount_curve = SubResource("Curve_kr6si")
color_ramp = SubResource("Gradient_38b5g")
[node name="BlobShadow" type="Decal" parent="Body"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00169557, -0.222867, 0.145518)
size = Vector3(1.6, 4, 3)
texture_albedo = ExtResource("11_5ul8v")
upper_fade = 2.0
lower_fade = 1.0
cull_mask = 1048573
[node name="AudioListener3D" type="AudioListener3D" parent="Body"]
current = true
[node name="InteriorCameraPosition" type="Marker3D" parent="Body"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0.9, 0.3)
[node name="TopDownCameraPosition" type="Marker3D" parent="Body"]
transform = Transform3D(-1, 8.74228e-08, 0, 3.82137e-15, 4.37114e-08, 1, 8.74228e-08, 1, -4.37114e-08, 0.00169557, 15.7771, 0.0955178)
[node name="ChainB1" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 1.10846, -1.55698)
[node name="Chain1" type="MeshInstance3D" parent="ChainB1"]
layers = 2
gi_mode = 2
mesh = SubResource("CapsuleMesh_i2aww")
surface_material_override/0 = SubResource("StandardMaterial3D_nrety")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ChainB1"]
shape = SubResource("CapsuleShape3D_eoojf")
[node name="ChainB2" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 0.803378, -1.75806)
[node name="Chain1" type="MeshInstance3D" parent="ChainB2"]
layers = 2
gi_mode = 2
mesh = SubResource("CapsuleMesh_i2aww")
surface_material_override/0 = SubResource("StandardMaterial3D_so248")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ChainB2"]
shape = SubResource("CapsuleShape3D_eoojf")
[node name="ChainB3" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 0.490045, -1.96106)
[node name="Chain1" type="MeshInstance3D" parent="ChainB3"]
layers = 2
gi_mode = 2
mesh = SubResource("CapsuleMesh_i2aww")
surface_material_override/0 = SubResource("StandardMaterial3D_c2qj1")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ChainB3"]
shape = SubResource("CapsuleShape3D_eoojf")
[node name="ChainB4" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.447167, -0.894451, 0, 0.894451, 0.447167, 0, 0.290326, -2.19413)
[node name="Chain1" type="MeshInstance3D" parent="ChainB4"]
layers = 2
gi_mode = 2
mesh = SubResource("CapsuleMesh_i2aww")
surface_material_override/0 = SubResource("StandardMaterial3D_ffy5m")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ChainB4"]
shape = SubResource("CapsuleShape3D_eoojf")
[node name="ChainB5" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.0993884, -0.995049, 0, 0.995049, 0.0993884, 0, 0.205717, -2.50193)
[node name="Chain1" type="MeshInstance3D" parent="ChainB5"]
layers = 2
gi_mode = 2
mesh = SubResource("CapsuleMesh_i2aww")
surface_material_override/0 = SubResource("StandardMaterial3D_l1evv")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ChainB5"]
shape = SubResource("CapsuleShape3D_eoojf")
[node name="PinJoint1" type="PinJoint3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.28044, -1.4153)
node_a = NodePath("../Body")
node_b = NodePath("../ChainB1")
[node name="PinJoint2" type="PinJoint3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.962693, -1.6492)
node_a = NodePath("../ChainB1")
node_b = NodePath("../ChainB2")
[node name="PinJoint3" type="PinJoint3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.644947, -1.85661)
node_a = NodePath("../ChainB2")
node_b = NodePath("../ChainB3")
params/bias = 0.5
[node name="PinJoint4" type="PinJoint3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.350687, -2.04279)
node_a = NodePath("../ChainB3")
node_b = NodePath("../ChainB4")
params/bias = 0.5
[node name="PinJoint5" type="PinJoint3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.217609, -2.33375)
node_a = NodePath("../ChainB4")
node_b = NodePath("../ChainB5")
params/bias = 0.5
[node name="Body2" type="VehicleBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.00169557, 0.222867, -3.97518)
mass = 10.0
center_of_mass_mode = 1
physics_material_override = SubResource("PhysicsMaterial_hvgqm")
[node name="Wheel1" type="VehicleWheel3D" parent="Body2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.573678, 0.115169, 1.10416)
use_as_traction = true
use_as_steering = true
wheel_roll_influence = 0.4
wheel_radius = 0.25
wheel_friction_slip = 1.0
suspension_travel = 2.0
suspension_stiffness = 40.0
damping_compression = 0.88
[node name="Wheel1" type="MeshInstance3D" parent="Body2/Wheel1"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Wheel2" type="VehicleWheel3D" parent="Body2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.573678, 0.115169, -0.783403)
use_as_traction = true
wheel_roll_influence = 0.4
wheel_radius = 0.25
wheel_friction_slip = 1.0
suspension_travel = 2.0
suspension_stiffness = 40.0
damping_compression = 0.88
[node name="Wheel2" type="MeshInstance3D" parent="Body2/Wheel2"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Wheel3" type="VehicleWheel3D" parent="Body2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.573678, 0.115169, 1.10416)
use_as_traction = true
use_as_steering = true
wheel_roll_influence = 0.4
wheel_radius = 0.25
wheel_friction_slip = 1.0
suspension_travel = 2.0
suspension_stiffness = 40.0
damping_compression = 0.88
[node name="Wheel3" type="MeshInstance3D" parent="Body2/Wheel3"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Wheel4" type="VehicleWheel3D" parent="Body2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.573678, 0.115169, -0.783403)
use_as_traction = true
wheel_roll_influence = 0.4
wheel_radius = 0.25
wheel_friction_slip = 1.0
suspension_travel = 2.0
suspension_stiffness = 40.0
damping_compression = 0.88
[node name="Wheel4" type="MeshInstance3D" parent="Body2/Wheel4"]
layers = 2
gi_mode = 2
mesh = ExtResource("2_uwuq1")
[node name="Body" type="MeshInstance3D" parent="Body2"]
layers = 2
gi_mode = 2
mesh = ExtResource("5_04cnp")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Body2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.588269, 0.0774262)
shape = SubResource("BoxShape3D_hbuqf")
[node name="BlobShadow" type="Decal" parent="Body2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00169557, -0.122867, 0.0251799)
size = Vector3(1.6, 4, 3)
texture_albedo = ExtResource("11_5ul8v")
upper_fade = 2.0
lower_fade = 1.0
cull_mask = 1048573
[node name="PinJoint6" type="PinJoint3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.148269, -2.64894)
node_a = NodePath("../ChainB5")
node_b = NodePath("../Body2")