From 6029d10e6286bfeb783c84bf833df1226583b9e0 Mon Sep 17 00:00:00 2001 From: Orkuncakilkaya Date: Tue, 29 Sep 2026 13:12:22 +0300 Subject: [PATCH] character: a seated body is held by its seat alone - no step to the walker while sitting, and a hold no longer turns it off the seat's heading The user's play of the bundle: the character shook while seated. chr_sit_tick eased the body onto the seat point at the ground's height, then the same frame's chr_travel handed it to the walker, which pushed it off a log, a bench or a boulder beside the seat; the next frame pulled it back. Unwalked, the game's walker parks as it does under a rider. A hold's turn toward the work fought the seat's yaw the same way. The new test sits the body against the boulder: 4.63 m from a seat at 5.7 before, still after. Co-Authored-By: Claude Opus 5.5 --- packages/ludic.character/steer.ludic | 2 +- .../ludic.character/tests/character_test.ludic | 18 ++++++++++++++++++ packages/ludic.character/update.ludic | 5 ++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/ludic.character/steer.ludic b/packages/ludic.character/steer.ludic index 292a97c3..def5068d 100644 --- a/packages/ludic.character/steer.ludic +++ b/packages/ludic.character/steer.ludic @@ -14,7 +14,7 @@ function chr_steer(character_st: mut CharacterState, dx: float, dz: float, mag: if run { top = character_st.chr_run_speed * CharacterBody.pace() } if CharacterBody.sneaking() { top = 1.3 } target = mag * top * lined - } else if CharacterBody.holding() and not character_st.chr_air { + } else if CharacterBody.holding() and not character_st.chr_air and not character_st.chr_sit { # a hold turns the body to the thing being worked, so the work is seen being done chr_turn_to(character_st, CharacterBody.hold_x() - character_st.chr_x, CharacterBody.hold_z() - character_st.chr_z, 6.0 * dt) } diff --git a/packages/ludic.character/tests/character_test.ludic b/packages/ludic.character/tests/character_test.ludic index 6641d175..f9362895 100644 --- a/packages/ludic.character/tests/character_test.ludic +++ b/packages/ludic.character/tests/character_test.ludic @@ -289,6 +289,24 @@ program CharacterTest { character_test_st.riding = false } + test "a seat against the boulder holds the body still: the walker never pushes it off the seat" (character_st: mut CharacterState, character_test_st: mut CharacterTestState) { + fresh(character_st, 0.0, 4.5, 0.0) + char_update(character_st, 0.0, 0.0, false, false, 0.0, 0.0, 1.0 / 60.0) + char_sit(character_st, 0.0, 5.7, 0.0, CHAR_SIT_SEAT) + for i in 0 .. 90 { char_update(character_st, 0.0, 0.0, false, false, 0.0, 0.0, 1.0 / 60.0) } + var most = 0.0 + for i in 0 .. 120 { + let x0 = body_x(character_st) + let y0 = body_y(character_st) + let z0 = body_z(character_st) + char_update(character_st, 0.0, 0.0, false, false, 0.0, 0.0, 1.0 / 60.0) + most = Math.max(most, Math.abs(body_x(character_st) - x0) + Math.abs(body_y(character_st) - y0) + Math.abs(body_z(character_st) - z0)) + } + expect(body_sitting(character_st)) + expect(most < 0.0005) + expect_near(body_z(character_st), 5.7, 0.01) + } + test "a hold stops the stick, and only its own reason lets it go" (character_st: mut CharacterState, character_test_st: mut CharacterTestState) { fresh(character_st, 0.0, 0.0, 0.0) character_test_st.mz = 1.0 diff --git a/packages/ludic.character/update.ludic b/packages/ludic.character/update.ludic index 1898dc07..eb7f6216 100644 --- a/packages/ludic.character/update.ludic +++ b/packages/ludic.character/update.ludic @@ -32,7 +32,10 @@ export function char_update(character_st: mut CharacterState, ix0: float, iz0: f mag = 1.0 } chr_steer(character_st, dx, dz, mag, run, dt) - let dist = chr_travel(character_st, dx, dz, -Math.sin(character_st.chr_yaw), -Math.cos(character_st.chr_yaw), jump, dt) + # seated, the seat holds the body (chr_sit_tick): handed to the walker too, it was pushed off a + # log or a bench and pulled back each frame, and shook + var dist = 0.0 + if not character_st.chr_sit or character_st.chr_swim { dist = chr_travel(character_st, dx, dz, -Math.sin(character_st.chr_yaw), -Math.cos(character_st.chr_yaw), jump, dt) } chr_gait(character_st, dist, dyaw, dpitch, dt) char_camera(character_st, dt) }