small racing game im working on
Diffstat (limited to 'scenes/track-base.gd')
-rw-r--r--scenes/track-base.gd10
1 files changed, 5 insertions, 5 deletions
diff --git a/scenes/track-base.gd b/scenes/track-base.gd
index bffb716..96f9e40 100644
--- a/scenes/track-base.gd
+++ b/scenes/track-base.gd
@@ -22,6 +22,7 @@ class_name TrackLoader
@onready var rail_r := $"Rail-R" as CSGPolygon3D
@onready var collision := $CollisionShape as CSGPolygon3D
@onready var sun := $Sun as DirectionalLight3D
+@onready var ground := $Ground as StaticBody3D
var checkpoints: Array[CheckPoint]
var finish: Finish
@@ -94,9 +95,6 @@ func _update():
vec(-rp - 3.0, 5.0),
vec(-rp, 5.0),
])
- # offset
- position = track.offset
-
# objects
for child in get_children():
if child is PathFollow3D:
@@ -115,7 +113,6 @@ func _update():
else:
start_pos = finish.global_position
start_rot = finish.global_rotation
- start_rot = start_rot.snapped(Vector3(PI/2, PI/2, PI/2))
# loopage
rail_l.path_joined = track.is_loop
@@ -124,6 +121,9 @@ func _update():
road.path_joined = track.is_loop
support.path_joined = track.is_loop
+ # offset
+ ground.global_position = track.offset
+
is_dirty = false
func _ready():
@@ -139,4 +139,4 @@ func make_follower(scene: PackedScene, ratio: float, scl: Vector3, collide: bool
add_child(follower)
follower.scale = scl
follower.progress_ratio = ratio # ratio set must be after add_child()
- return follower \ No newline at end of file
+ return follower