diff --git a/assets/Black Metal.material b/assets/Black Metal.material index c824924..4619833 100644 Binary files a/assets/Black Metal.material and b/assets/Black Metal.material differ diff --git a/assets/ChassiBlackMetal.material b/assets/ChassiBlackMetal.material index 05b6860..d27a4d2 100644 Binary files a/assets/ChassiBlackMetal.material and b/assets/ChassiBlackMetal.material differ diff --git a/assets/Chassis Metal.material b/assets/Chassis Metal.material index fc11560..0467a9c 100644 Binary files a/assets/Chassis Metal.material and b/assets/Chassis Metal.material differ diff --git a/assets/ChassisRedMetal.material b/assets/ChassisRedMetal.material index cee6529..3011f5c 100644 Binary files a/assets/ChassisRedMetal.material and b/assets/ChassisRedMetal.material differ diff --git a/assets/ChassisWhiteMetal.material b/assets/ChassisWhiteMetal.material index eec93f0..b46c60b 100644 Binary files a/assets/ChassisWhiteMetal.material and b/assets/ChassisWhiteMetal.material differ diff --git a/assets/Cloth.material b/assets/Cloth.material index c410f33..6e435be 100644 Binary files a/assets/Cloth.material and b/assets/Cloth.material differ diff --git a/assets/DarkGlass.material b/assets/DarkGlass.material new file mode 100644 index 0000000..891509d Binary files /dev/null and b/assets/DarkGlass.material differ diff --git a/assets/Metal.material b/assets/Metal.material index 0324386..1acdcd6 100644 Binary files a/assets/Metal.material and b/assets/Metal.material differ diff --git a/assets/Tyre Black.material b/assets/Tyre Black.material index 4b47329..737da42 100644 Binary files a/assets/Tyre Black.material and b/assets/Tyre Black.material differ diff --git a/assets/Tyre White.material b/assets/Tyre White.material index ca815de..3139527 100644 Binary files a/assets/Tyre White.material and b/assets/Tyre White.material differ diff --git a/assets/basic_buggy.glb b/assets/basic_buggy.glb index 1898e68..81a4643 100644 Binary files a/assets/basic_buggy.glb and b/assets/basic_buggy.glb differ diff --git a/assets/beetlecar.glb b/assets/beetlecar.glb index d848163..d7aa7c2 100644 Binary files a/assets/beetlecar.glb and b/assets/beetlecar.glb differ diff --git a/assets/bugmobile.glb b/assets/bugmobile.glb index dd49b96..008e72a 100644 Binary files a/assets/bugmobile.glb and b/assets/bugmobile.glb differ diff --git a/assets/source/basic_buggy.blend b/assets/source/basic_buggy.blend index d1595ec..b580764 100644 Binary files a/assets/source/basic_buggy.blend and b/assets/source/basic_buggy.blend differ diff --git a/assets/source/beetlecar.blend b/assets/source/beetlecar.blend index 2deba02..9c0b7f0 100644 Binary files a/assets/source/beetlecar.blend and b/assets/source/beetlecar.blend differ diff --git a/assets/source/bugmobile.blend b/assets/source/bugmobile.blend index a2e2ef2..be2abd5 100644 Binary files a/assets/source/bugmobile.blend and b/assets/source/bugmobile.blend differ diff --git a/vehicles/beetlecar.tscn b/vehicles/beetlecar.tscn index ba0aea6..4805dfe 100644 --- a/vehicles/beetlecar.tscn +++ b/vehicles/beetlecar.tscn @@ -1,8 +1,11 @@ -[gd_scene load_steps=13 format=2] +[gd_scene load_steps=16 format=2] [ext_resource path="res://vehicles/vehicle.gd" type="Script" id=1] [ext_resource path="res://assets/beetlecar.glb" type="PackedScene" id=2] [ext_resource path="res://vehicles/tire_smoke.tscn" type="PackedScene" id=3] +[ext_resource path="res://vehicles/pedal.gd" type="Script" id=4] +[ext_resource path="res://vehicles/meter.gd" type="Script" id=5] +[ext_resource path="res://vehicles/steering_controller.gd" type="Script" id=6] [sub_resource type="Curve" id=3] _data = [ Vector2( 0, 0 ), 0.0, 3.60634, 0, 1, Vector2( 0.15566, 0.561364 ), 1.56017, 1.56017, 0, 0, Vector2( 0.830189, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ] @@ -70,6 +73,26 @@ suspension_stiffness = 12.0 damping_compression = 0.75 damping_relaxation = 0.8 +[node name="brake_pedal" parent="chassis/cockpit" index="0"] +script = ExtResource( 4 ) + +[node name="clutch_pedal" parent="chassis/cockpit" index="1"] +script = ExtResource( 4 ) + +[node name="gas_pedal" parent="chassis/cockpit" index="2"] +script = ExtResource( 4 ) + +[node name="rpm_meter" parent="chassis/cockpit" index="3"] +script = ExtResource( 5 ) +needle_path = NodePath("rpm_needle") + +[node name="speed_meter" parent="chassis/cockpit" index="4"] +script = ExtResource( 5 ) +needle_path = NodePath("speed_needle") + +[node name="steering_controller" parent="chassis/cockpit" index="5"] +script = ExtResource( 6 ) + [node name="rear_left" parent="." index="3"] transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, 0.621506, 0.375, -0.83483 ) use_as_traction = true @@ -141,7 +164,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.621508, 0.0502438, 1.19336 transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, 0.621506, 0.0502438, 1.19336 ) [node name="cockpit" type="Position3D" parent="." index="13"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.159514, 0.993516, 0.421211 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.122976, 1.13133, 0.315432 ) [node name="hood" type="Position3D" parent="." index="14"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.01256, 0.87905 ) @@ -151,3 +174,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.535274, 1.89154 ) [node name="static_follow" type="Position3D" parent="." index="16"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.59115, -3.01375 ) + +[connection signal="brake_updated" from="." to="chassis/cockpit/brake_pedal" method="_on_value_updated"] +[connection signal="clutch_updated" from="." to="chassis/cockpit/clutch_pedal" method="_on_value_updated"] +[connection signal="rpm_updated" from="." to="chassis/cockpit/rpm_meter" method="_on_value_updated"] +[connection signal="speed_updated" from="." to="chassis/cockpit/speed_meter" method="_on_value_updated"] +[connection signal="steering_updated" from="." to="chassis/cockpit/steering_controller" method="_on_steering_updated"] +[connection signal="throttle_updated" from="." to="chassis/cockpit/gas_pedal" method="_on_value_updated"] diff --git a/vehicles/buggy.tscn b/vehicles/buggy.tscn index fbb1b92..94833e1 100644 --- a/vehicles/buggy.tscn +++ b/vehicles/buggy.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=17 format=2] +[gd_scene load_steps=16 format=2] [ext_resource path="res://assets/basic_buggy.glb" type="PackedScene" id=1] [ext_resource path="res://vehicles/tire_smoke.tscn" type="PackedScene" id=2] [ext_resource path="res://vehicles/vehicle.gd" type="Script" id=3] [ext_resource path="res://vehicles/steering_controller.gd" type="Script" id=4] [ext_resource path="res://vehicles/meter.gd" type="Script" id=5] -[ext_resource path="res://vehicles/pedal.gd" type="Script" id=6] [ext_resource path="res://vehicles/pedal.gd" type="Script" id=7] [sub_resource type="Curve" id=2] @@ -63,13 +62,13 @@ automatic_gear_up_threshold = 0.85 automatic_gear_down_threshold = 0.4 [node name="brake_pedal" parent="chassis/cockpit" index="0"] -script = ExtResource( 6 ) +script = ExtResource( 7 ) [node name="clutch_pedal" parent="chassis/cockpit" index="1"] script = ExtResource( 7 ) [node name="gas_pedal" parent="chassis/cockpit" index="2"] -script = ExtResource( 6 ) +script = ExtResource( 7 ) [node name="rpm_meter" parent="chassis/cockpit" index="3"] transform = Transform( 1, 0, 0, 0, 0.351842, 0.93606, 0, -0.93606, 0.351842, 0.036114, 0.360487, 0.695986 ) @@ -172,7 +171,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.950753, -0.0380455, -1.41438 transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, -0.950755, -0.038045, -1.41438 ) [node name="cockpit" type="Position3D" parent="." index="13"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.32501, -0.0235026 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.44962, 0.200323 ) [node name="hood" type="Position3D" parent="." index="14"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.31056, 0.894584 ) diff --git a/vehicles/bugmobile.tscn b/vehicles/bugmobile.tscn index 852db8a..8baaca5 100644 --- a/vehicles/bugmobile.tscn +++ b/vehicles/bugmobile.tscn @@ -1,8 +1,11 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=18 format=2] [ext_resource path="res://vehicles/tire_smoke.tscn" type="PackedScene" id=1] [ext_resource path="res://assets/bugmobile.glb" type="PackedScene" id=2] [ext_resource path="res://vehicles/vehicle.gd" type="Script" id=3] +[ext_resource path="res://vehicles/steering_controller.gd" type="Script" id=4] +[ext_resource path="res://vehicles/pedal.gd" type="Script" id=5] +[ext_resource path="res://vehicles/meter.gd" type="Script" id=6] [sub_resource type="Curve" id=18] _data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.179245, 0.584091 ), 4.91185, 4.91185, 0, 0, Vector2( 0.603774, 0.954545 ), 6.05975, 6.05975, 0, 0, Vector2( 0.806604, 0.989773 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ] @@ -89,6 +92,26 @@ suspension_max_force = 7000.0 damping_compression = 0.9 damping_relaxation = 0.92 +[node name="brake_pedal" parent="chassis/cockpit" index="0"] +script = ExtResource( 5 ) + +[node name="clutch_pedal" parent="chassis/cockpit" index="1"] +script = ExtResource( 5 ) + +[node name="gas_pedal" parent="chassis/cockpit" index="2"] +script = ExtResource( 5 ) + +[node name="steering_controller" parent="chassis/cockpit" index="3"] +script = ExtResource( 4 ) + +[node name="rpm_meter" parent="chassis/cockpit/steering_controller" index="0"] +script = ExtResource( 6 ) +needle_path = NodePath("rpm_needle") + +[node name="speed_meter" parent="chassis/cockpit/steering_controller" index="1"] +script = ExtResource( 6 ) +needle_path = NodePath("speed_needle") + [node name="front_right" parent="." index="4"] use_as_steering = true wheel_radius = 0.35 @@ -140,7 +163,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.18159, 0.117865, -1.93644 ) transform = Transform( 1, 0, 0, 0, 1, -1.50996e-07, 0, 1.50996e-07, 1, -1.02536, 0.101852, -1.93766 ) [node name="cockpit" type="Position3D" parent="." index="13"] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.265389, 1.1411, 0.337731 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.03657, 0 ) [node name="hood" type="Position3D" parent="." index="14"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.00873, 0.756477 ) @@ -150,3 +173,10 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.605405, 1.5324 ) [node name="static_follow" type="Position3D" parent="." index="16"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.88984, -4.78212 ) + +[connection signal="brake_updated" from="." to="chassis/cockpit/brake_pedal" method="_on_value_updated"] +[connection signal="clutch_updated" from="." to="chassis/cockpit/clutch_pedal" method="_on_value_updated"] +[connection signal="rpm_updated" from="." to="chassis/cockpit/steering_controller/rpm_meter" method="_on_value_updated"] +[connection signal="speed_updated" from="." to="chassis/cockpit/steering_controller/speed_meter" method="_on_value_updated"] +[connection signal="steering_updated" from="." to="chassis/cockpit/steering_controller" method="_on_steering_updated"] +[connection signal="throttle_updated" from="." to="chassis/cockpit/gas_pedal" method="_on_value_updated"] diff --git a/vehicles/steering_controller.gd b/vehicles/steering_controller.gd index 79bbacc..4624a0c 100644 --- a/vehicles/steering_controller.gd +++ b/vehicles/steering_controller.gd @@ -8,4 +8,4 @@ func update_angle(steering_angle_percent: float) -> void: func _on_steering_updated(_steering_angle: float, steering_angle_percent: float) -> void: - update_angle(-steering_angle_percent) + update_angle(steering_angle_percent)