## 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()