From e84e8d987897caea6c06081b31f013fd2aab0d82 Mon Sep 17 00:00:00 2001 From: CodedOre <47981497+CodedOre@users.noreply.github.com> Date: Thu, 8 Jul 2021 15:47:19 +0200 Subject: [PATCH 1/4] Ambulance: Add vehicle scene --- vehicles/scenes/Ambulance.tscn | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 vehicles/scenes/Ambulance.tscn diff --git a/vehicles/scenes/Ambulance.tscn b/vehicles/scenes/Ambulance.tscn new file mode 100644 index 0000000..b7f5dac --- /dev/null +++ b/vehicles/scenes/Ambulance.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://assets/models/vehicles/Ambulance.glb" type="PackedScene" id=1] +[ext_resource path="res://assets/materials/Body.material" type="Material" id=2] +[ext_resource path="res://assets/materials/Glass.material" type="Material" id=3] + +[node name="Ambulance" instance=ExtResource( 1 )] +collision_layer = 2 +collision_mask = 3 + +[node name="WheelFrontLeft" parent="." index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.819475, 0.397583, 1.85367 ) + +[node name="WheelFrontLeft" parent="WheelFrontLeft" index="0"] +transform = Transform( 0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0 ) +material/0 = ExtResource( 2 ) + +[node name="WheelRearLeft" parent="." index="1"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.819475, 0.397583, -1.45996 ) + +[node name="WheelRearLeft" parent="WheelRearLeft" index="0"] +transform = Transform( 0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0 ) +material/0 = ExtResource( 2 ) + +[node name="WheelFrontRight" parent="." index="2"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.819475, 0.397583, 1.85367 ) + +[node name="WheelFrontRight" parent="WheelFrontRight" index="0"] +transform = Transform( 0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0 ) +material/0 = ExtResource( 2 ) + +[node name="WheelRearRight" parent="." index="3"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.819475, 0.397583, -1.45996 ) + +[node name="WheelRearRight" parent="WheelRearRight" index="0"] +transform = Transform( 0.01, 0, 0, 0, 0.01, 0, 0, 0, 0.01, 0, 0, 0 ) +material/0 = ExtResource( 2 ) + +[node name="VehicleBody" parent="." index="4"] +material/0 = ExtResource( 2 ) + +[node name="Glass" parent="VehicleBody" index="0"] +material/0 = ExtResource( 3 ) + +[node name="Plates" parent="VehicleBody" index="1"] +material/0 = ExtResource( 2 ) + +[node name="SteeringWheel" parent="VehicleBody" index="2"] +transform = Transform( 1, 0, 0, 0, 0.348425, 0.937337, 0, -0.937337, 0.348425, 43.1792, 109.383, -125.515 ) +material/0 = ExtResource( 2 ) From 0b941ea7ff5600f571bc8d2798f655ca121578ba Mon Sep 17 00:00:00 2001 From: CodedOre <47981497+CodedOre@users.noreply.github.com> Date: Thu, 8 Jul 2021 16:08:01 +0200 Subject: [PATCH 2/4] Ambulance: Add collision shape --- vehicles/scenes/Ambulance.tscn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vehicles/scenes/Ambulance.tscn b/vehicles/scenes/Ambulance.tscn index b7f5dac..ecbfae0 100644 --- a/vehicles/scenes/Ambulance.tscn +++ b/vehicles/scenes/Ambulance.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://assets/models/vehicles/Ambulance.glb" type="PackedScene" id=1] [ext_resource path="res://assets/materials/Body.material" type="Material" id=2] [ext_resource path="res://assets/materials/Glass.material" type="Material" id=3] +[ext_resource path="res://assets/collisions/vehicles/Ambulance.shape" type="Shape" id=4] [node name="Ambulance" instance=ExtResource( 1 )] collision_layer = 2 @@ -48,3 +49,7 @@ material/0 = ExtResource( 2 ) [node name="SteeringWheel" parent="VehicleBody" index="2"] transform = Transform( 1, 0, 0, 0, 0.348425, 0.937337, 0, -0.937337, 0.348425, 43.1792, 109.383, -125.515 ) material/0 = ExtResource( 2 ) + +[node name="CollisionShape" type="CollisionShape" parent="." index="5"] +transform = Transform( 0.01, 0, 0, 0, -4.37114e-10, -0.01, 0, 0.01, -4.37114e-10, 0, 0, 0 ) +shape = ExtResource( 4 ) From 0810561bd7db5cea1d06723c1b82b873b3310641 Mon Sep 17 00:00:00 2001 From: CodedOre <47981497+CodedOre@users.noreply.github.com> Date: Thu, 8 Jul 2021 16:12:45 +0200 Subject: [PATCH 3/4] Ambulance: Add light configurations --- vehicles/scenes/Ambulance.tscn | 132 ++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 3 deletions(-) diff --git a/vehicles/scenes/Ambulance.tscn b/vehicles/scenes/Ambulance.tscn index ecbfae0..5437a1a 100644 --- a/vehicles/scenes/Ambulance.tscn +++ b/vehicles/scenes/Ambulance.tscn @@ -1,13 +1,19 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://assets/models/vehicles/Ambulance.glb" type="PackedScene" id=1] [ext_resource path="res://assets/materials/Body.material" type="Material" id=2] [ext_resource path="res://assets/materials/Glass.material" type="Material" id=3] [ext_resource path="res://assets/collisions/vehicles/Ambulance.shape" type="Shape" id=4] +[ext_resource path="res://assets/materials/VehicleLights/RearLightOff.material" type="Material" id=5] +[ext_resource path="res://assets/materials/VehicleLights/FrontLightOff.material" type="Material" id=6] +[ext_resource path="res://assets/materials/VehicleLights/ReverseLightOff.material" type="Material" id=7] +[ext_resource path="res://assets/materials/VehicleLights/TurningSignalOff.material" type="Material" id=8] +[ext_resource path="res://scripts/vehicles/VehicleLight.gd" type="Script" id=9] [node name="Ambulance" instance=ExtResource( 1 )] collision_layer = 2 collision_mask = 3 +Lights = [ NodePath("VehicleBody/LightFrontLeft"), NodePath("VehicleBody/LightFrontRight"), NodePath("VehicleBody/LightRearLeft"), NodePath("VehicleBody/LightRearRight"), NodePath("VehicleBody/LightReverseLeft"), NodePath("VehicleBody/LightReverseRight"), NodePath("VehicleBody/LightTurningFrontLeft"), NodePath("VehicleBody/LightTurningFrontRight"), NodePath("VehicleBody/LightTurningRearLeft"), NodePath("VehicleBody/LightTurningRearRight") ] [node name="WheelFrontLeft" parent="." index="0"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.819475, 0.397583, 1.85367 ) @@ -43,10 +49,130 @@ material/0 = ExtResource( 2 ) [node name="Glass" parent="VehicleBody" index="0"] material/0 = ExtResource( 3 ) -[node name="Plates" parent="VehicleBody" index="1"] +[node name="LightFrontLeft" parent="VehicleBody" index="1"] +material/0 = ExtResource( 6 ) +script = ExtResource( 9 ) +FrontLight = 2 + +[node name="Light" type="SpotLight" parent="VehicleBody/LightFrontLeft" index="0"] +transform = Transform( 100, 0, 0, 0, -4.37114e-06, -100, 0, 100, -4.37114e-06, 78, 254, -87 ) +light_energy = 4.0 +shadow_enabled = true +spot_range = 30.0 +spot_angle = 35.0 + +[node name="LightFrontRight" parent="VehicleBody" index="2"] +material/0 = ExtResource( 6 ) +script = ExtResource( 9 ) +FrontLight = 2 + +[node name="Light" type="SpotLight" parent="VehicleBody/LightFrontRight" index="0"] +transform = Transform( 100, 0, 0, 0, -4.37114e-06, -100, 0, 100, -4.37114e-06, -78, 254, -87 ) +light_energy = 4.0 +shadow_enabled = true +spot_range = 30.0 +spot_angle = 35.0 + +[node name="LightRearLeft" parent="VehicleBody" index="3"] +material/0 = ExtResource( 5 ) +script = ExtResource( 9 ) +RearLight = true +BrakeLight = true + +[node name="Light" type="SpotLight" parent="VehicleBody/LightRearLeft" index="0"] +transform = Transform( 78.8011, 3.45374e-06, -61.5661, 61.5661, -1.00304e-05, 78.8011, -3.45374e-06, -100, -1.00304e-05, 94, -226, -84 ) +light_color = Color( 1, 0, 0, 1 ) +light_energy = 4.0 +spot_range = 3.0 +spot_angle = 75.0 + +[node name="LightRearRight" parent="VehicleBody" index="4"] +material/0 = ExtResource( 5 ) +script = ExtResource( 9 ) +RearLight = true +BrakeLight = true + +[node name="Light" type="SpotLight" parent="VehicleBody/LightRearRight" index="0"] +transform = Transform( -78.8011, 7.81564e-06, 61.5661, 61.5661, -2.69114e-06, 78.8011, 7.81564e-06, 100, -2.69114e-06, -94, -226, -84 ) +light_color = Color( 1, 0, 0, 1 ) +light_energy = 4.0 +spot_range = 3.0 +spot_angle = 75.0 + +[node name="LightReverseLeft" parent="VehicleBody" index="5"] +material/0 = ExtResource( 7 ) +script = ExtResource( 9 ) +ReverseLight = true + +[node name="Light" type="SpotLight" parent="VehicleBody/LightReverseLeft" index="0"] +transform = Transform( -4.37114e-06, 95.1057, -30.9017, 0, 30.9017, 95.1057, 100, 4.1572e-06, -1.35076e-06, 90, -224, -77 ) +light_energy = 4.0 +spot_range = 4.0 +spot_angle = 75.0 + +[node name="LightReverseRight" parent="VehicleBody" index="6"] +material/0 = ExtResource( 7 ) +script = ExtResource( 9 ) +ReverseLight = true + +[node name="Light" type="SpotLight" parent="VehicleBody/LightReverseRight" index="0"] +transform = Transform( -4.37114e-06, -95.1057, 30.9017, 0, 30.9017, 95.1057, -100, 4.1572e-06, -1.35076e-06, -90, -224, -77 ) +light_energy = 4.0 +spot_range = 4.0 +spot_angle = 75.0 + +[node name="LightTurningFrontLeft" parent="VehicleBody" index="7"] +material/0 = ExtResource( 8 ) +script = ExtResource( 9 ) +TurningSignal = 1 + +[node name="Light" type="SpotLight" parent="VehicleBody/LightTurningFrontLeft" index="0"] +transform = Transform( 57.3577, -6.94733e-06, -81.9152, -81.9152, -1.33457e-05, -57.3577, -6.94732e-06, 100, -1.33457e-05, 94, 240, -88 ) +light_color = Color( 1, 0.654902, 0, 1 ) +light_energy = 2.0 +spot_range = 3.0 +spot_angle = 85.0 + +[node name="LightTurningFrontRight" parent="VehicleBody" index="8"] +material/0 = ExtResource( 8 ) +script = ExtResource( 9 ) +TurningSignal = 2 + +[node name="Light" type="SpotLight" parent="VehicleBody/LightTurningFrontRight" index="0"] +transform = Transform( -57.3577, -6.87832e-06, 81.9152, -81.9152, -3.58062e-06, -57.3577, 6.87832e-06, -100, -3.58062e-06, -94, 240, -88 ) +light_color = Color( 1, 0.654902, 0, 1 ) +light_energy = 2.0 +spot_range = 3.0 +spot_angle = 85.0 + +[node name="LightTurningRearLeft" parent="VehicleBody" index="9"] +material/0 = ExtResource( 8 ) +script = ExtResource( 9 ) +TurningSignal = 1 + +[node name="Light" type="SpotLight" parent="VehicleBody/LightTurningRearLeft" index="0"] +transform = Transform( -70.7107, -7.462e-06, -70.7107, -70.7107, -3.09086e-06, 70.7107, -7.462e-06, 100, -3.09086e-06, 94, -228, -98 ) +light_color = Color( 1, 0.654902, 0, 1 ) +light_energy = 2.0 +spot_range = 3.0 +spot_angle = 85.0 + +[node name="LightTurningRearRight" parent="VehicleBody" index="10"] +material/0 = ExtResource( 8 ) +script = ExtResource( 9 ) +TurningSignal = 2 + +[node name="Light" type="SpotLight" parent="VehicleBody/LightTurningRearRight" index="0"] +transform = Transform( 70.7107, -1.28028e-06, 70.7107, -70.7107, -3.09086e-06, 70.7107, 1.28028e-06, -100, -3.09086e-06, -94, -228, -98 ) +light_color = Color( 1, 0.654902, 0, 1 ) +light_energy = 2.0 +spot_range = 3.0 +spot_angle = 85.0 + +[node name="Plates" parent="VehicleBody" index="11"] material/0 = ExtResource( 2 ) -[node name="SteeringWheel" parent="VehicleBody" index="2"] +[node name="SteeringWheel" parent="VehicleBody" index="12"] transform = Transform( 1, 0, 0, 0, 0.348425, 0.937337, 0, -0.937337, 0.348425, 43.1792, 109.383, -125.515 ) material/0 = ExtResource( 2 ) From 8497d5ad5d52411fe12782a7f5fbcfc22b4a6742 Mon Sep 17 00:00:00 2001 From: CodedOre <47981497+CodedOre@users.noreply.github.com> Date: Thu, 8 Jul 2021 16:15:18 +0200 Subject: [PATCH 4/4] Ambulance: Add additional data --- vehicles/scenes/Ambulance.tscn | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/vehicles/scenes/Ambulance.tscn b/vehicles/scenes/Ambulance.tscn index 5437a1a..9eadb38 100644 --- a/vehicles/scenes/Ambulance.tscn +++ b/vehicles/scenes/Ambulance.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=2] +[gd_scene load_steps=12 format=2] [ext_resource path="res://assets/models/vehicles/Ambulance.glb" type="PackedScene" id=1] [ext_resource path="res://assets/materials/Body.material" type="Material" id=2] @@ -9,11 +9,17 @@ [ext_resource path="res://assets/materials/VehicleLights/ReverseLightOff.material" type="Material" id=7] [ext_resource path="res://assets/materials/VehicleLights/TurningSignalOff.material" type="Material" id=8] [ext_resource path="res://scripts/vehicles/VehicleLight.gd" type="Script" id=9] +[ext_resource path="res://vehicles/data/Van.tres" type="Resource" id=10] +[ext_resource path="res://scripts/utils/CameraPoint.gd" type="Script" id=11] [node name="Ambulance" instance=ExtResource( 1 )] collision_layer = 2 collision_mask = 3 +Data = ExtResource( 10 ) Lights = [ NodePath("VehicleBody/LightFrontLeft"), NodePath("VehicleBody/LightFrontRight"), NodePath("VehicleBody/LightRearLeft"), NodePath("VehicleBody/LightRearRight"), NodePath("VehicleBody/LightReverseLeft"), NodePath("VehicleBody/LightReverseRight"), NodePath("VehicleBody/LightTurningFrontLeft"), NodePath("VehicleBody/LightTurningFrontRight"), NodePath("VehicleBody/LightTurningRearLeft"), NodePath("VehicleBody/LightTurningRearRight") ] +Cameras = [ NodePath("CameraPoints/ChaseCamera"), NodePath("CameraPoints/DriverCamera") ] +OuterMirrorPoint = NodePath("MirrorPoints/OuterMirror") +SteeringWheel = NodePath("VehicleBody/SteeringWheel") [node name="WheelFrontLeft" parent="." index="0"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.819475, 0.397583, 1.85367 ) @@ -176,6 +182,28 @@ material/0 = ExtResource( 2 ) transform = Transform( 1, 0, 0, 0, 0.348425, 0.937337, 0, -0.937337, 0.348425, 43.1792, 109.383, -125.515 ) material/0 = ExtResource( 2 ) -[node name="CollisionShape" type="CollisionShape" parent="." index="5"] +[node name="CameraPoints" type="Spatial" parent="." index="5"] + +[node name="ChaseCamera" type="Position3D" parent="CameraPoints" index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0 ) +script = ExtResource( 11 ) +CameraDistance = 4.5 +CameraAngle = 15 +CameraTurn = 1 + +[node name="DriverCamera" type="Position3D" parent="CameraPoints" index="1"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.45, 1.55, 0.6 ) +script = ExtResource( 11 ) +FixedPosition = true +CameraTurn = 2 + +[node name="MirrorPoints" type="Spatial" parent="." index="6"] + +[node name="OuterMirror" type="Position3D" parent="MirrorPoints" index="0"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.7, -2.25 ) +script = ExtResource( 11 ) +FixedPosition = true + +[node name="CollisionShape" type="CollisionShape" parent="." index="7"] transform = Transform( 0.01, 0, 0, 0, -4.37114e-10, -0.01, 0, 0.01, -4.37114e-10, 0, 0, 0 ) shape = ExtResource( 4 )