From 9d1ddac43027e37c7d9eeec0753277e25adb603d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Sat, 20 Nov 2021 17:04:57 +0100 Subject: [PATCH] Use curve to better orientate checkpoints along the track --- scenes/tracks/track.gd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scenes/tracks/track.gd b/scenes/tracks/track.gd index 3a3324e..09d2d65 100644 --- a/scenes/tracks/track.gd +++ b/scenes/tracks/track.gd @@ -32,14 +32,16 @@ func _ready() -> void: for _checkpoint_number in range(checkpoint_count): var new_checkpoint: Area = Area.new() new_checkpoint.add_child(_build_checkpoint_collision()) - new_checkpoint.transform.origin = path.curve.interpolate_baked(section) + new_checkpoint.look_at_from_position( + checkpoints.to_global(path.curve.interpolate_baked(section)), + checkpoints.to_global(path.curve.interpolate_baked(section + 0.01)), + path.curve.interpolate_baked_up_vector(section) + ) section += section_size checkpoints.add_child(new_checkpoint) if GlobalSettings.debug: - var mesh = CylinderMesh.new() - mesh.top_radius = checkpoint_dim.y - mesh.bottom_radius = checkpoint_dim.y - mesh.height = checkpoint_dim.x + var mesh = CubeMesh.new() + mesh.size = Vector3(checkpoint_dim.x, checkpoint_dim.y, 5) if debug_material != null: mesh.material = debug_material var meshinst = MeshInstance.new()