fix movement through the map is easier

This commit is contained in:
DottsGit
2026-06-06 12:28:48 -04:00
parent 050912ca61
commit 64e024eb32
+31 -28
View File
@@ -77,6 +77,28 @@ func _build_dust2_layout() -> void:
root_csg.add_child(hole)
return hole
# Helper function to carve a precise slope (no lips or hard stops)
var carve_ramp = func(start_pos: Vector3, width: float, length: float, height: float, is_x_axis: bool, reverse: bool):
var box = CSGBox3D.new()
box.operation = CSGShape3D.OPERATION_SUBTRACTION
var slope = atan2(height, length)
var dir = 1.0 if reverse else -1.0
if not is_x_axis: # Ramp goes along Z
box.size = Vector3(width, 50, 50)
box.rotation.x = slope * dir
var mid_point = start_pos + Vector3(0, height / 2.0, (length / 2.0) * dir)
box.position = mid_point + (Vector3.UP.rotated(Vector3.RIGHT, box.rotation.x) * 25.0)
else: # Ramp goes along X
box.size = Vector3(50, 50, width)
box.rotation.z = -slope * dir
var mid_point = start_pos + Vector3((length / 2.0) * dir, height / 2.0, 0)
box.position = mid_point + (Vector3.UP.rotated(Vector3.FORWARD, box.rotation.z) * 25.0)
root_csg.add_child(box)
return box
# ---------------------------------------------------------
# LAYOUT (with generous overlaps to prevent getting stuck)
# ---------------------------------------------------------
@@ -99,8 +121,10 @@ func _build_dust2_layout() -> void:
# ---------------------------------------------------------
# Lower B Tunnels (Connects from Mid at X=0 to West)
carve_tunnel.call(Vector3(-18, 0, 30), Vector3(40, 6, 8))
# Spiral stairs up to Upper B Tunnels
carve_tunnel.call(Vector3(-34, 0, 30), Vector3(12, 10, 12))
# Spiral stairs up to Upper B Tunnels (Using a ramp instead of stairs for smoothness)
carve_ramp.call(Vector3(-34, 0, 34), 8.0, 15.0, 4.0, false, false) # Ramp from Lower to Upper B
# Upper B Tunnels
carve_tunnel.call(Vector3(-34, 4, 15), Vector3(8, 6, 30))
@@ -112,13 +136,7 @@ func _build_dust2_layout() -> void:
carve_tunnel.call(Vector3(-15, 4, -18), Vector3(20, 4, 4)) # Window
# CT Spawn Ramp to B Site
carve_open.call(Vector3(-15, 0, -15), Vector3(12, 8, 12))
var ramp_carve = CSGBox3D.new()
ramp_carve.operation = CSGShape3D.OPERATION_SUBTRACTION
ramp_carve.size = Vector3(8, 10, 15)
ramp_carve.rotation_degrees.x = -25
ramp_carve.position = Vector3(-15, 2, -15)
root_csg.add_child(ramp_carve)
carve_ramp.call(Vector3(-15, 0, -15), 10.0, 15.0, 4.0, true, false) # Ramp up from CT to B Door
# ---------------------------------------------------------
# A SIDE
@@ -141,32 +159,17 @@ func _build_dust2_layout() -> void:
carve_open.call(Vector3(30, 4, -15), Vector3(30, 8, 30))
# Ramp up to A site from Long
var a_ramp = CSGBox3D.new()
a_ramp.operation = CSGShape3D.OPERATION_SUBTRACTION
a_ramp.size = Vector3(15, 10, 15)
a_ramp.rotation_degrees.x = 25
a_ramp.position = Vector3(30, 2, -5)
root_csg.add_child(a_ramp)
carve_ramp.call(Vector3(30, 0, -5), 15.0, 15.0, 4.0, false, false)
# Ramp down from A Site to CT Spawn
var ct_ramp = CSGBox3D.new()
ct_ramp.operation = CSGShape3D.OPERATION_SUBTRACTION
ct_ramp.size = Vector3(15, 10, 15)
ct_ramp.rotation_degrees.z = 25
ct_ramp.position = Vector3(15, 2, -25)
root_csg.add_child(ct_ramp)
carve_ramp.call(Vector3(15, 0, -25), 15.0, 15.0, 4.0, true, true)
# Catwalk / A Short
carve_open.call(Vector3(15, 4, 5), Vector3(20, 8, 8))
carve_open.call(Vector3(20, 4, -5), Vector3(8, 8, 15))
# Stairs from Mid to Catwalk
var mid_stairs = CSGBox3D.new()
mid_stairs.operation = CSGShape3D.OPERATION_SUBTRACTION
mid_stairs.size = Vector3(8, 8, 15)
mid_stairs.rotation_degrees.x = 35
mid_stairs.position = Vector3(8, 2, 5)
root_csg.add_child(mid_stairs)
# Stairs from Mid to Catwalk (Smooth ramp)
carve_ramp.call(Vector3(5, 0, 5), 8.0, 12.0, 4.0, true, true)
# Floor
var floor = CSGBox3D.new()