Add invisible edge barrier and fix an out-of-bounds POI
We only ever built the inner region-to-region borders, never a wall at the island's own outer rim (girdle) — nothing stopped the player walking off into the (collision-less) pavilion below. Added _build_edge_barrier(): 6 invisible BoxShape3D walls along the girdle chords. Also found the actual bug behind "one POI is outside": a facet's true outer boundary is a straight hexagon chord, not an arc, so its usable radius varies with angle — girdle_radius only at the two corners, dropping to girdle_radius*cos(30°) (~87%) at the facet's own bisector. Ort6 was placed at exactly the bisector angle with radius 44, just past the true edge (~43.3 there) despite being "inside" the naive [table_radius, girdle_radius] range. Moved it to angle 38°/radius 36, comfortable inside the true boundary at that angle. Verified headless: pushing the player outward with constant velocity for 3 simulated seconds pins it at radius 42.64 (never crosses the ~43.3 true edge), settled and on_floor=true throughout. Re-verified the POI/gate group logic still passes after moving Ort6.
This commit is contained in:
parent
92f220e208
commit
72bc3a6553
@ -232,7 +232,7 @@ poi_name = "Ort 5"
|
||||
marker_color = Color(0.2, 0.5, 1, 1)
|
||||
|
||||
[node name="Ort6" parent="." instance=ExtResource("5_lquwl") groups=["region1_pois"]]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 38.1, -4.471, 22.0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 28.37, -3.1, 22.17)
|
||||
poi_name = "Ort 6"
|
||||
marker_color = Color(0.7, 0.3, 0.9, 1)
|
||||
|
||||
|
||||
33
terrain.gd
33
terrain.gd
@ -47,6 +47,7 @@ func _ready() -> void:
|
||||
_build_crown()
|
||||
_build_pavilion()
|
||||
_build_region_borders()
|
||||
_build_edge_barrier()
|
||||
|
||||
func _hex_angle(k: int) -> float:
|
||||
return deg_to_rad(angle_offset_deg) + float(k) / 6.0 * TAU
|
||||
@ -220,3 +221,35 @@ func _spawn_border_prop(parent: Node3D, kind: Dictionary, pos: Vector3) -> void:
|
||||
inst.add_child(cs)
|
||||
|
||||
parent.add_child(inst)
|
||||
|
||||
# ═══════════════════════════════════════════════
|
||||
# RAND-BARRIERE — unsichtbare Wand entlang der Rundiste, damit man
|
||||
# an der Außenkante der Insel nicht in den Pavillon (rein optisch,
|
||||
# ohne Kollision) hinunterfällt.
|
||||
# ═══════════════════════════════════════════════
|
||||
func _build_edge_barrier() -> void:
|
||||
var barrier := StaticBody3D.new()
|
||||
barrier.name = "EdgeBarrier"
|
||||
add_child(barrier)
|
||||
|
||||
var girdle_pts: Array[Vector3] = []
|
||||
for k in range(6):
|
||||
var a := _hex_angle(k)
|
||||
girdle_pts.append(Vector3(cos(a) * girdle_radius, -crown_drop, sin(a) * girdle_radius))
|
||||
|
||||
for k in range(6):
|
||||
var k1 := (k + 1) % 6
|
||||
var p0 := girdle_pts[k]
|
||||
var p1 := girdle_pts[k1]
|
||||
var length := p0.distance_to(p1)
|
||||
var dir := (p1 - p0) / length
|
||||
var mid := (p0 + p1) * 0.5
|
||||
|
||||
var box := BoxShape3D.new()
|
||||
box.size = Vector3(1.0, 6.0, length)
|
||||
|
||||
var cs := CollisionShape3D.new()
|
||||
cs.shape = box
|
||||
cs.position = mid + Vector3(0.0, 1.0, 0.0)
|
||||
cs.rotation.y = atan2(dir.x, dir.z)
|
||||
barrier.add_child(cs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user