fix(client): cutaway cuts the camera-character sightline corridor, not a proximity dome (T-1088)

Live-session finding: the half-disc cut bit nearby side walls while leaving
the wall actually occluding the character at full height, with dome-contour
scallops across the two-row walls. Rewritten as a sightline corridor: walls
within CUT_CORRIDOR_HALF_W of the character's x, camera-side, out to a
pitch-derived reach (WALL_H / tan(pitch) — how far a wall can still occlude
in ortho; ~4.3 m at -30, breathes with the T-cycle tilt) drop to the stub.
FollowCamera3D exposes pitch_deg(); reach clamped 0.5-16 m.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-06 19:01:49 +02:00
co-authored by Claude Fable 5
parent b09a50efbf
commit 2db7dd25e1
7 changed files with 111 additions and 38 deletions
@@ -96,6 +96,12 @@ func _process(delta: float) -> void:
_apply_orbit()
## Current (smoothed) pitch in degrees from horizontal — consumed by the
## cutaway corridor reach (sandbox root pushes WALL_H / tan(pitch) per frame).
func pitch_deg() -> float:
return _pitch_deg
# Dev affordances only — there is deliberately NO yaw/rotation input path here.
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey:
+8 -5
View File
@@ -188,7 +188,7 @@ func _ready() -> void:
# the shader defaults mirror them only for standalone/editor use.
_wall_material.set_shader_parameter("u_wall_h", SandboxConstants.WALL_H)
_wall_material.set_shader_parameter("u_cut_height", SandboxConstants.CUT_HEIGHT)
_wall_material.set_shader_parameter("u_cut_radius", SandboxConstants.CUT_RADIUS)
_wall_material.set_shader_parameter("u_corridor_half_w", SandboxConstants.CUT_CORRIDOR_HALF_W)
_wall_material.set_shader_parameter("u_cut_band", SandboxConstants.CUT_BAND)
_wall_mm = _make_layer("WallMM", wall_mesh, _wall_material)
@@ -217,11 +217,14 @@ func get_store_size() -> int:
## Per-frame cutaway anchor (design §8): pass the rig's INTERPOLATED
## world-space position (PlayerRig.global_position — it already carries the
## 45 deg WorldRoot rotation, matching the shader's world-space test) so the cut
## zone glides with the character and spatial smoothstep becomes temporal
## smoothness. One uniform write per frame — the entire CPU cost.
func set_cutaway_char_pos(world_pos: Vector3) -> void:
## 45 deg WorldRoot rotation, matching the shader's world-space test) plus the
## pitch-derived corridor reach (WALL_H / tan(camera pitch) — how far south a
## WALL_H wall can still occlude the character in ortho). The cut corridor
## glides with the character and breathes with the tilt; two uniform writes
## per frame — the entire CPU cost.
func set_cutaway_char_pos(world_pos: Vector3, reach_m: float) -> void:
_wall_material.set_shader_parameter("u_char_pos_xz", Vector2(world_pos.x, world_pos.z))
_wall_material.set_shader_parameter("u_cut_reach", reach_m)
func _make_layer(layer_name: String, mesh: Mesh, material: ShaderMaterial) -> MultiMeshInstance3D:
+8 -1
View File
@@ -270,7 +270,14 @@ func _install_facing_provider() -> void:
func _per_frame_update(delta: float) -> void:
if not _first_snapshot_seen:
return
greybox.set_cutaway_char_pos(player_rig.global_position)
# Corridor reach: how far camera-side a WALL_H wall can still occlude the
# character in ortho at the current (smoothed) pitch. Clamped: the -5 deg
# frontal preset would otherwise ask for a ~29 m corridor.
var pitch_abs: float = maxf(absf(camera_rig.pitch_deg()), 5.0)
var reach: float = clampf(
SandboxConstants.WALL_H / tan(deg_to_rad(pitch_abs)), 0.5, 16.0
)
greybox.set_cutaway_char_pos(player_rig.global_position, reach)
_anim.update(delta)
+5 -4
View File
@@ -19,10 +19,11 @@ const SUBTILE_M := 0.5
const WALL_H := 2.5
## Cutaway stub height (m) camera-side walls drop to.
const CUT_HEIGHT := 0.75
## Cutaway half-disc radius (m) around the character.
const CUT_RADIUS := 5.0
## Cutaway smoothstep falloff band (m) at the disc edge.
const CUT_BAND := 1.5
## Cutaway sightline-corridor half-width (m) — character is 1 subtile wide;
## this covers them plus margin. Corridor length is pitch-derived per frame.
const CUT_CORRIDOR_HALF_W := 1.4
## Cutaway smoothstep falloff band (m) at the corridor edges.
const CUT_BAND := 0.75
# -- Locomotion interpolation (design §4) --------------------------------------