H11: Hide pines between the shoulder camera and the player

PropView.clear_view() hides every pine whose drawn shape crosses the line
from the camera to the followed player's chest or head, or holds the
camera, and shows it again once the line is clear. Candidates come from the
trunks in the ground's solid index around the line. MatchView.follow()
applies it; look_from() (framing, overview) shows everything again.

Test: a player against the most crowded pine on seed 2, at 16 yaws, hides
exactly the blocking pines and brings them all back afterwards. Captures
canopy and canopy_before (tools/capture.sh canopy ...).

Closes #75

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 21:25:26 -05:00
co-authored by Claude Opus 5.5
parent dff83fbe11
commit b9f5493c03
8 changed files with 173 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
## Capture scenario for H11: a player standing against a pine in a crowded stand, seen
## from the shoulder camera at a yaw that puts canopies between the lens and the player.
## With `screen` off, the hidden pines are put back, showing what the fix prevents.
extends Node3D
@export var screen: bool = true
@export var match_seed: int = 2
func _ready() -> void:
var sim: Simulation = Simulation.new(match_seed)
var best: int = -1
var crowd: int = -1
for prop: int in sim.props.count():
if sim.props.kind_name(prop) != "pine" or prop % 7 != 0:
continue
var around: int = sim.props.near(sim.props.boxes[prop].get_center(), 6.0).size()
if around > crowd:
crowd = around
best = prop
var trunk: AABB = sim.props.boxes[best]
var player: SimEntity = sim.entities.find(sim.add_player())
player.drop_state = Drop.NONE
player.on_ground = true
player.health = 100
var x: float = trunk.end.x + Tuning.PLAYER_RADIUS + 0.05
player.position = Vector3(x, sim.ground.terrain_height(x, trunk.get_center().z), trunk.get_center().z)
var view: MatchView = MatchView.new()
view.setup(sim, player.id)
add_child(view)
view.sync()
# The yaw that hides the most pines: the worst view without the fix.
var worst: float = 0.0
var most: int = -1
for step: int in 16:
var yaw: float = TAU * step / 16.0
view.follow(player.id, deg_to_rad(-6.0), yaw)
if view.props.screened().size() > most:
most = view.props.screened().size()
worst = yaw
view.follow(player.id, deg_to_rad(-6.0), worst)
print("canopy_scene: pine %d, %d pines around, %d hidden at yaw %.2f, screen %s" % [best, crowd, most, worst, screen])
if not screen:
var none: Array[Vector3] = []
view.props.clear_view(sim.ground, view.camera.transform.origin, none)
view.settle()