Skip to content

Commit

Permalink
added wall to road
Browse files Browse the repository at this point in the history
  • Loading branch information
FelicePollano committed Aug 2, 2020
1 parent 01905c7 commit 31f540f
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 42 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="a67360eeb62587680e09abb4777de954"
dest_md5="0a82f20d727196b104464f3a50112ff9"

Binary file not shown.
Binary file not shown.
64 changes: 34 additions & 30 deletions Car.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=60 format=2]
[gd_scene load_steps=62 format=2]

[ext_resource path="res://assets/cars/audirx8.glb" type="PackedScene" id=1]
[ext_resource path="res://scripts/Car.gd" type="Script" id=2]
Expand Down Expand Up @@ -687,6 +687,17 @@ surfaces/0 = {
"vertex_count": 86
}

[sub_resource type="SpatialMaterial" id=52]

[sub_resource type="SpatialMaterial" id=51]
flags_transparent = true
albedo_color = Color( 0.854902, 0.796078, 0.796078, 0 )
emission_enabled = true
emission = Color( 0.898039, 0.0509804, 0.0509804, 1 )
emission_energy = 1.67
emission_operator = 0
emission_on_uv2 = false

[node name="Car" instance=ExtResource( 1 )]
input_ray_pickable = false
mass = 59.4
Expand All @@ -695,13 +706,21 @@ sleeping = true
script = ExtResource( 2 )

[node name="front_left" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.893, -0.413, 1.196 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.38
wheel_rest_length = 0.04
wheel_friction_slip = 8.0
suspension_travel = 0.04
suspension_stiffness = 70.0
damping_compression = 0.8
damping_relaxation = 0.9

[node name="break_disc" parent="front_left" index="0"]
mesh = SubResource( 2 )

[node name="wheel_rot_x" parent="front_left" index="1"]
[node name="wheel_rot_x" parent="front_left" index="2"]
transform = Transform( 1, 0, 0, 0, 0.379252, -0.925293, 0, 0.925293, 0.379252, 0, 0, 0 )

[node name="polySurface8" type="MeshInstance" parent="front_left/wheel_rot_x/rin" index="0"]
Expand Down Expand Up @@ -759,13 +778,21 @@ mesh = SubResource( 13 )
material/0 = ExtResource( 5 )

[node name="front_right" parent="." index="3"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.893, -0.401, 1.196 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.38
wheel_rest_length = 0.04
wheel_friction_slip = 8.0
suspension_travel = 0.04
suspension_stiffness = 70.0
damping_compression = 0.8
damping_relaxation = 0.9

[node name="break_disc001" parent="front_right" index="0"]
mesh = SubResource( 14 )

[node name="wheel_rot_x001" parent="front_right" index="1"]
[node name="wheel_rot_x001" parent="front_right" index="2"]
transform = Transform( 1, 0, 0, 0, 0.379252, -0.925293, 0, 0.925293, 0.379252, 0, 0, 0 )

[node name="polySurface14" parent="front_right/wheel_rot_x001" index="0"]
Expand Down Expand Up @@ -818,7 +845,7 @@ damping_relaxation = 0.9
[node name="break_disc002" parent="back_left" index="0"]
mesh = SubResource( 27 )

[node name="wheel_rot_x002" parent="back_left" index="1"]
[node name="wheel_rot_x002" parent="back_left" index="2"]
transform = Transform( 1, 0, 0, 0, 0.379252, -0.925293, 0, 0.925293, 0.379252, 0, 0, 0 )

[node name="polySurface26" parent="back_left/wheel_rot_x002" index="0"]
Expand Down Expand Up @@ -867,7 +894,7 @@ damping_relaxation = 0.9
[node name="break_disc003" parent="back_right" index="0"]
mesh = SubResource( 39 )

[node name="wheel_rot_x003" parent="back_right" index="1"]
[node name="wheel_rot_x003" parent="back_right" index="2"]
transform = Transform( 1, 0, 0, 0, 0.379252, -0.925293, 0, 0.925293, 0.379252, 0, 0, 0 )

[node name="polySurface37" parent="back_right/wheel_rot_x003" index="0"]
Expand Down Expand Up @@ -903,32 +930,9 @@ mesh = SubResource( 49 )
[node name="polySurface47" parent="back_right/wheel_rot_x003" index="10"]
mesh = SubResource( 50 )

[node name="front_left" parent="." index="7"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.893, -0.413, 1.196 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.38
wheel_rest_length = 0.04
wheel_friction_slip = 8.0
suspension_travel = 0.04
suspension_stiffness = 70.0
damping_compression = 0.8
damping_relaxation = 0.9

[node name="front_right" parent="." index="8"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.893, -0.401, 1.196 )
use_as_traction = true
use_as_steering = true
wheel_radius = 0.38
wheel_rest_length = 0.04
wheel_friction_slip = 8.0
suspension_travel = 0.04
suspension_stiffness = 70.0
damping_compression = 0.8
damping_relaxation = 0.9

[node name="back_lights001" parent="audi_r8/audi_r8001/back_movement/front_movement/car1/back/back_lights" index="0"]
material/0 = ExtResource( 8 )
material/0 = SubResource( 52 )
material/1 = SubResource( 51 )

[node name="back_lights003" parent="audi_r8/audi_r8001/back_movement/front_movement/car1/back/back_lights" index="1"]
material/0 = ExtResource( 8 )
Expand Down
10 changes: 10 additions & 0 deletions Car2.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

[sub_resource type="SpatialMaterial" id=1]
albedo_color = Color( 0.054902, 0.152941, 0.482353, 1 )
emission_enabled = true
emission = Color( 0, 0, 0, 1 )
emission_energy = 1.0
emission_operator = 0
emission_on_uv2 = false

[sub_resource type="SpatialMaterial" id=2]
albedo_color = Color( 0.886275, 0.105882, 0.105882, 1 )
Expand All @@ -15,6 +20,11 @@ emission_on_uv2 = false

[sub_resource type="SpatialMaterial" id=3]
albedo_color = Color( 0.25098, 0.584314, 0.521569, 1 )
emission_enabled = true
emission = Color( 0, 0, 0, 1 )
emission_energy = 1.0
emission_operator = 0
emission_on_uv2 = false

[sub_resource type="SpatialMaterial" id=4]
albedo_color = Color( 0.258824, 0.584314, 0.239216, 1 )
Expand Down
100 changes: 88 additions & 12 deletions Screen1.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[gd_scene load_steps=12 format=2]
[gd_scene load_steps=14 format=2]

[ext_resource path="res://assets/textures/TexturesCom_SoilCracked0140_1_seamless_S.jpg" type="Texture" id=1]
[ext_resource path="res://scripts/Suspension-Controls.gd" type="Script" id=2]
[ext_resource path="res://scripts/Camera.gd" type="Script" id=3]
[ext_resource path="res://assets/textures/TexturesCom_Asphalt_1x1_512_albedo.png" type="Texture" id=4]
[ext_resource path="res://assets/textures/TexturesCom_Roads0148_1_seamless_S.jpg" type="Texture" id=4]
[ext_resource path="res://Car2.tscn" type="PackedScene" id=5]
[ext_resource path="res://scripts/Car.gd" type="Script" id=6]
[ext_resource path="res://assets/Materials/rail-materiall.tres" type="Material" id=7]

[sub_resource type="ConvexPolygonShape" id=6]
points = PoolVector3Array( -100, -0.1, -100, 100, -0.1, -100, 100, -0.1, 100, -100, -0.1, 100 )
[sub_resource type="ConvexPolygonShape" id=1]
points = PoolVector3Array( -100, -0.1, -100, 100, -0.1, -100, 100, -0.1, 1000, -100, -0.1, 1000 )

[sub_resource type="PlaneMesh" id=2]
size = Vector2( 1, 1 )
Expand All @@ -21,25 +22,26 @@ uv1_scale = Vector3( 670, 600, 220 )

[sub_resource type="Curve3D" id=4]
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.151871, 0, 6.22618, -0.253914, 0, -8.8368, 0.253914, 0, 8.8368, -6.3484, 0, 25.9923, -15.8983, 0, -4.90688, 15.8983, 0, 4.90688, 9.54986, 0, 37.7688, 1.53874, 0, 32.2062, -1.53874, 0, -32.2062, 44.5195, 2.26978, 24.0203, 6.15938, 0, 16.2384, -6.15938, 0, -16.2384, 30.085, 3.16415, -8.37165, 2.55157, 0, 12.169, -2.55157, 0, -12.169, 39.7764, 1.86574, -36.0711, 0, 0, 0, 0, 0, 0, 25.2519, 0, -46.2368, 13.9355, 0, 6.47707, -13.9355, 0, -6.47707, -8.31114, 0, -47.4145, 0, 0, 0, 0, 0, 0, -34.2194, 0, -40.9374, 6.67334, 0, -3.53295, -6.67334, 0, 3.53295, -45.9959, 0, -30.9274, -2.15902, 0, -8.43982, 2.15902, 0, 8.43982, -44.8183, 0, -9.33715, -7.0659, 0, 4.12177, 7.0659, 0, -4.12177, -31.2753, 0, 3.617, -22.7679, 0, 9.61746, 22.7679, 0, -9.61746, -11.2553, 0, -22.8801, 0, 0, 0, 0, 0, 0, -0.151871, 0, 6.22618 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.151871, 0, 6.22618, -0.253914, 0, -8.8368, 0.253914, 0, 8.8368, -6.3484, 0, 25.9923, -15.8983, 0, -4.90688, 15.8983, 0, 4.90688, 9.64758, 0.538475, 48.524, 1.53874, 0, 32.2062, -1.53874, 0, -32.2062, 44.5195, 2.26978, 24.0203, 6.15938, 0, 16.2384, -6.15938, 0, -16.2384, 30.085, 3.16415, -8.37165, 2.55157, 0, 12.169, -2.55157, 0, -12.169, 39.7764, 1.86574, -36.0711, 0, 0, 0, 0, 0, 0, 25.2519, 0, -46.2368, 15.6988, 0.0657808, 6.4664, -15.6988, -0.0657808, -6.4664, -8.31114, 0, -47.4145, -25.7385, -0.810669, 3.06011, 25.7385, 0.810669, -3.06011, -11.2553, 0, -22.8801, 0, 0, 0, 0, 0, 0, -0.151871, 0, 6.22618 ),
"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
}

[sub_resource type="SpatialMaterial" id=5]
albedo_color = Color( 0.304957, 0.320312, 0.301544, 1 )
albedo_color = Color( 0.364706, 0.372549, 0.403922, 1 )
albedo_texture = ExtResource( 4 )
metallic_specular = 0.0
metallic_texture = ExtResource( 4 )
uv1_scale = Vector3( 0.6, 0.6, 0.5 )
uv2_scale = Vector3( 5, 5, 5 )

[sub_resource type="SpatialMaterial" id=6]
albedo_color = Color( 0.403922, 0.227451, 0.133333, 1 )

[node name="Spatial" type="Spatial"]

[node name="StaticBody" type="StaticBody" parent="."]

[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0 )
shape = SubResource( 6 )
shape = SubResource( 1 )

[node name="MeshInstance" type="MeshInstance" parent="StaticBody/CollisionShape"]
transform = Transform( 1000, 0, 0, 0, 1, 0, 0, 0, 1000, 0, -0.1, 0 )
Expand All @@ -64,21 +66,95 @@ target_distance = 6.5
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.159424, 0 )

[node name="Path" type="Path" parent="Spatial"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.656097, 0 )
curve = SubResource( 4 )

[node name="Road" type="CSGPolygon" parent="Spatial/Path"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.104652, -0.024559, -0.0419006 )
snap = 0.117
use_collision = true
invert_faces = true
polygon = PoolVector2Array( -4.5, 0, -4.5, 0, 4.5, 0.1, 4.5, 0.1 )
mode = 2
path_node = NodePath("..")
path_interval = 1.809
path_rotation = 2
path_local = true
path_continuous_u = false
path_joined = true
material = SubResource( 5 )

[node name="RightBarrier" type="CSGPolygon" parent="Spatial/Path"]
visible = false
use_collision = true
polygon = PoolVector2Array( 5, -0.2, 5, 1.5, 4.4, 1.5, 4.4, -0.1 )
mode = 2
path_node = NodePath("..")
path_interval = 1.0
path_rotation = 2
path_local = false
path_continuous_u = false
path_joined = true
material = SubResource( 5 )

[node name="LeftBarrier" type="CSGPolygon" parent="Spatial/Path"]
visible = false
use_collision = true
polygon = PoolVector2Array( -5, -0.2, -5, 1.5, -4.4, 1.5, -4.4, -0.1 )
mode = 2
path_node = NodePath("..")
path_interval = 1.0
path_rotation = 2
path_local = false
path_continuous_u = false
path_joined = true

[node name="LeftRail" type="CSGPolygon" parent="Spatial/Path"]
invert_faces = true
polygon = PoolVector2Array( -5, 0.6, -5, 0.68, -4.95, 0.68, -4.95, 0.6 )
mode = 2
path_node = NodePath("..")
path_interval = 1.0
path_rotation = 2
path_local = false
path_continuous_u = false
path_joined = true
material = ExtResource( 7 )

[node name="RightRail" type="CSGPolygon" parent="Spatial/Path"]
invert_faces = true
polygon = PoolVector2Array( 5, 0.6, 5, 0.68, 4.95, 0.68, 4.95, 0.6 )
mode = 2
path_node = NodePath("..")
path_interval = 1.0
path_rotation = 2
path_local = false
path_continuous_u = false
path_joined = true
material = ExtResource( 7 )

[node name="RightWall" type="CSGPolygon" parent="Spatial/Path"]
invert_faces = true
polygon = PoolVector2Array( 0, 0, 5.9, 0, 8, -3 )
mode = 2
path_node = NodePath("..")
path_interval = 1.0
path_rotation = 2
path_local = false
path_continuous_u = false
path_joined = true
material = SubResource( 6 )

[node name="LeftWall" type="CSGPolygon" parent="Spatial/Path"]
invert_faces = true
polygon = PoolVector2Array( 0, -0.1, -5.9, -0.1, -8, -3 )
mode = 2
path_node = NodePath("..")
path_interval = 1.0
path_rotation = 2
path_local = false
path_continuous_u = false
path_joined = true
material = SubResource( 6 )

[node name="CanvasLayer" type="CanvasLayer" parent="."]

Expand Down Expand Up @@ -243,7 +319,7 @@ __meta__ = {
}

[node name="Car2" parent="." instance=ExtResource( 5 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.95442, 0.294149, 0 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 2.95442, 1.27826, 0 )
script = ExtResource( 6 )
[connection signal="value_changed" from="CanvasLayer/Damping-compression" to="CanvasLayer/Damping-compression" method="_on_value_changed"]
[connection signal="value_changed" from="CanvasLayer/Damping-relaxation" to="CanvasLayer/Damping-relaxation" method="_on_value_changed"]
Expand Down
7 changes: 7 additions & 0 deletions assets/Materials/rail-materiall.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_resource type="SpatialMaterial" format=2]

[resource]
albedo_color = Color( 0.796078, 0.913725, 0.94902, 1 )
metallic = 0.73
metallic_specular = 0.92
roughness = 0.54
Binary file modified assets/cars/back_light.material
Binary file not shown.
Binary file modified assets/cars/backlight_yellow.material
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions assets/textures/TexturesCom_Roads0148_1_seamless_S.jpg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[remap]

importer="texture"
type="StreamTexture"
path.s3tc="res://.import/TexturesCom_Roads0148_1_seamless_S.jpg-a49dc1627aebe4294fbab12249b48cd7.s3tc.stex"
path.etc2="res://.import/TexturesCom_Roads0148_1_seamless_S.jpg-a49dc1627aebe4294fbab12249b48cd7.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}

[deps]

source_file="res://assets/textures/TexturesCom_Roads0148_1_seamless_S.jpg"
dest_files=[ "res://.import/TexturesCom_Roads0148_1_seamless_S.jpg-a49dc1627aebe4294fbab12249b48cd7.s3tc.stex", "res://.import/TexturesCom_Roads0148_1_seamless_S.jpg-a49dc1627aebe4294fbab12249b48cd7.etc2.stex" ]

[params]

compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
6 changes: 6 additions & 0 deletions scripts/Car.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ export var joy_throttle = JOY_ANALOG_R2
export var throttle_mult = 1.0
export var joy_brake = JOY_ANALOG_L2
export var brake_mult = 1.0
var backlight = null;


func _ready():
# Called every time the node is added to the scene.
# Initialization here
backlight=get_node("audi_r8/audi_r8001/back_movement/front_movement/car1/back/back_lights/back_lights001")
pass

func _physics_process(delta):
Expand All @@ -36,7 +39,10 @@ func _physics_process(delta):
if Input.is_action_pressed("ui_up"):
throttle_val = 1.0
if Input.is_action_pressed("ui_down"):
backlight.get_surface_material(1).emission_energy=5
brake_val = 1.0
else:
backlight.get_surface_material(1).emission_energy=1
if Input.is_action_pressed("ui_left"):
steer_val = 1.0
elif Input.is_action_pressed("ui_right"):
Expand Down

0 comments on commit 31f540f

Please sign in to comment.