Save Point
README.md
seatView
The hangout's seated view in front of a television. Sitting on a seat that faces a TV (the living-room sofa, the bed facing the bedroom TV), the camera stands high and out to the side of the sitter, a three-quarter view past the shoulder looking down across the lap to the screen: the sitter's hands and the controller in them sit in the lower third of the frame, the TV in the upper two thirds. The wheel, a pinch or a pad's RT/LT (stations.seatZoom) moves the view along the line toward the screen: eight even steps (each notch clamped to -1..1), eased, from that far end to the near end nearGap 0.52 m short of the screen (the watch view stands at 0.41 m). The aim follows the zoom: at the far end it points lapAim (0.6) of the way from the screen down to the hands, and turns onto the screen as the view closes in. The zoom is kept while seated and starts over on standing up.
Which side: an end seat looks in over its own furniture (the rest of the sofa, the other half of the bed) rather than past its end, where a floor lamp or side table stands; a middle seat takes the side away from the screen. Once a second, the side is also checked by ray against colliders between the eye and the hands / screen (the sitters, the held controller, the station and the seat's own furniture are looked through), and flipped if the other side sees more.
Who drives it: Seat calls drive(dt, seat, tv, true) every frame while the local player sits facing a TV with free hands or holding something that is not a TV controller (the instant camera, a print): look input (mouse / right stick, Seat forwards it to look) then turns the view up to lookYawMax either way, so the sitter aims at what Interact picks up from the table. PadControl calls drive while a seated player holds a TV controller (the look eases back to the aim) and pause for its watch view. A held Game Boy (its close-up), the instant camera's viewfinder (instantPhoto.borrowView) or a mount camera (a watch view) holds the camera instead, and the seated view stands aside. The far end is framed for the sitter: chooseFrame scores a grid of candidate eyes in the seat's frame (frameSearch.xs/ys/zs, side), lenses (fovs) and aims (laps, the share of the way from the screen down to the hands) by projecting the sitter's real wrists and held item, head (headR 0.2 m with hair, kept headGap clear of the hands) and the screen's glass (glass 0.23 x 0.17 m half-size) into a 16:9 frame; a candidate needs the hands inside hands (10-90% across, 42-92% down), the glass inside glassBox (clear of the frame edges and the player card in the top-left), the hands visible over the seat's back (back: the furniture has no colliders) and nothing solid on the way, then the largest glass wins (centre weighs the hands off the middle). An end seat keeps the side over its own furniture. It is chosen when the seat, screen, held item or body changes and again 2 s and 6 s later (a fresh hold settles), eased between choices; framing() reads the choice, reframe() forces a new one, lastSearch counts why candidates fell out. With no valid candidate the fixed far end (view {1.0, 1.25, -0.5}, lapAim 0.65, fov 46°) is used. The lens widens back to the camera's own as the zoom closes in; pause gives the camera's own back unless someone else changed it since.
Giving the camera back: Seat calls release on standing up, which hands the camera to the player's follow camera whenever it has no behaviour (or the seated view held it under a mount), whatever is in hand, unless a Game Boy close-up or the viewfinder holds it (they give it back themselves). watch(dt), called every frame while the local player is not seated, gives an unowned camera (no behaviour, nobody placing it) back to the follow camera after 0.5 s, so no exit can leave the camera dead.
Never through anything: the far end is pulled in for a wall or big furniture between the sitter's head and it (cameraCollision.clearDistance), and the zoom stops short of any solid collider on the line (cameraCollision.solidDistance: the coffee table, the TV) and headClear 0.32 m short of another player's head.
API: stationFor(seat), drive(dt, seat, tv), pause(), release(), isDriving(), zoom() (current, target), setZoom(t). Tunables are fields on the module table (view {x 1.0 side, y 1.5 up, z -0.6 behind}, lapAim, nearGap, step, ease, headClear, reach, stations).