garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/sitting-down.md

raw


topic: sitting-down triggers: [sit, bench, seat, picnic table, sit at bench, seated pose, captured clip, sit clip, 13_04, street furniture, interact prompt, protocol 19, seated on the wire, systems/player/avatar.rs, systems::interact, simulator/src/state.rs, geo/src/furniture.rs, Seated, is_seated, MAX_SEAT_OFFSET_M, SEAT_SLIDE_SECS, "--ui sit"] updated: 2026-11-15

Sitting is a captured clip and a display offset

"Sit at Bench" appeared as soon as systems::world_places started reading the pois layer, and for a while it did nothing you could see: interact::act fired the one-shot Interact gesture that every other prompt fires, wrote a line of text, and left the avatar standing beside the bench. Two separate things were missing, and neither is the obvious one.

The sit is a captured clip

The pack's sit is cut from CMU take 13_04 ("sit on stepstool"): the still, seated stretch, hands on the thighs (human-pack), retargeted onto whatever body the player designed and grounded by its lowest ankle like every other clip. It sits in the same AnimationGraph as the rest, so it cross-fades and is chosen by PoseClip::Sit exactly like walk or wave.

Until 2026-10-18 the Quaternius characters had no sit and one was synthesised from the rig at spawn time (retired/quaternius-avatars.md has how, and its traps).

The seat height is the stool's, not the bench's. A captured pose cannot be re-solved for a different seat the way the synthesised one was, so a body whose legs are longer or shorter than the subject's sits a little into or above the slat. Nothing measures that yet.

A seat is a display offset, not a position

The second half is that the avatar cannot stand where it has to sit. The bench is a solid prop (world_places gives every form a circle collider), so collision stops the avatar ~0.6 m short of the slat. And online the sim owns the avatar's translation and has never heard of a bench — it holds no map data and never will — so writing the seat into the position would be overwritten by the next snapshot, and writing it locally would fight reconciliation for as long as the player sat there.

So resources::Seated carries a world-XZ offset measured once, at the moment of sitting, and avatar::update_avatar_model_pose applies it to the model holders — the same place, and for the same reason, as the flight lean. Same shape as terrain_lift. The follow camera adds it too (AvatarState::seat_shift), or it spends the sit framing the pavement beside the bench.

The offset eases over SEAT_SLIDE_SECS, matched to SIT_FADE, so the body finishes arriving as it finishes sitting. That is what Seated::rising is for: the seat outlives the decision to get up by however long the slide takes, and is_seated() — not seated.is_some() — is the question to ask before blocking movement or choosing a pose.

What ends a sit

Any movement input, a jump, leaving Follow mode, and a teleport. The teleport is the one that is not merely tidy: the offset points at a bench in the city being left, so it is cleared outright rather than eased.

On the wire (protocol 19)

ClientIntent::seated and AvatarStateDto::seated carry the seat as Option<[f32; 2]> — the offset, not the place, which is what makes it portable at all. Each client measured the bench in the frame its own map is anchored in, and those frames differ by a translation; a delta survives that, a position does not. The facing needs no field: a sitter turns to face out of the seat and that is already the replicated yaw.

Sitting is a level, not an edge like the jump and the emote beside it. It is resent in every snapshot for as long as the sit lasts, so an avatar that comes into range mid-sit is drawn sitting — the same property EMOTE_REPLICATE_SECS buys for a wave, without a timer, because a sit has no natural length.

The blend is not replicated. The wire carries the whole offset and each viewer eases onto it off its own clock, so a sit costs one field per snapshot rather than an animation sampled twenty times a second.

The sim polices it, because this is the one field that separates where an avatar is from where it is drawn. It has no map and cannot check that there is a bench there, so it does the two things that do not need one: it bounds the offset (MAX_SEAT_OFFSET_M, and refuses a non-finite one) and it drops the seat the moment the same intent asks to move, fly or jump. Without the second rule, sitting is a way to walk around displaced from your own position — invisible to anything reasoning about proximity, since the position it reasons about stays honest. a_seat_is_bounded_and_does_not_survive_moving pins both.

What it does not do

Seeing it

--ui sit seats the avatar on a synthetic bench half a metre ahead of it, so a headless capture can photograph the pose without a streamed city having to put a real bench where the camera is:

CARTO_TILE_URL="https://tiles.cartopolis.org/tiles/osm/{z}/{x}/{y}" \
cargo run -p cartopolis -- --shot /tmp/sit.png --shot-mode avatar \
    --at 53.2194,6.5665,4 --look=-10,110 --ui sit --size 700x800

It runs every frame and after the teleport, unlike the rest of the --ui seeding, because the teleport clears the seat.

--shot-mode avatar did not work at all until this landed, which is what made the pose so hard to look at. Follow is not on offer offline (free_camera::follow_available wants a session) and every scripted run is offline, so camera_mode_toggle dropped the camera to Fly on the frame after the teleport put it in Follow: the mode the harness documents as "the right mode for checking avatars" quietly produced a free-camera view of wherever the avatar was not, and — once this feature existed — stood the seated avatar back up on the way past. shot_harness::hold_scripted_camera_mode re-asserts the mode every frame for the length of the run. Nothing about the interactive rule changed; offline still has no Follow.