[PR #689] [MERGED] Swimming pose and stroke on the player model #2733

Closed
opened 2026-11-02 15:58:39 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/689
Author: @ludovic111
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: fix/swim-pose


📝 Commits (1)

  • c7ad9b8 Swimming pose and stroke on the player model

📊 Changes

4 files changed (+221 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/perspective.rs (+11 -0)
📝 crates/horizon-client/src/mobs.rs (+33 -0)
📝 crates/horizon-client/src/mobs/anim.rs (+152 -0)
📝 crates/horizon-client/src/mobs/render.rs (+25 -11)

📄 Description

What and why

Fixes #535. Fixes #534.

Sprint-swimming itself already worked: in game on main, 3 s of sprint-swimming covers 10 blocks against 5.5 without sprint, and the player drops to the swimming box (eye 0.4). The swimming / player_travel harnesses cover the state and the speed. What was missing is the pose on the model. The third-person player (and the inventory preview) was drawn upright and walking, so it looked like no swimming happened. Crawling under a one-block gap had the same problem.

  • LivingEntity.updateSwimAmount: swimAmount eases 0.09 a tick toward isVisuallySwimming (the SWIMMING pose, or FALL_FLYING after a glide ended), interpolated per frame (getSwimAmount).
  • AvatarRenderer.setupRotations: the body tips forward by lerp(swimAmount, 0, isInWater ? -90 - xRot : -90) and, in the swimming pose, moves (0, -1, 0.3) along the swimming box. These avatar rotations now come after LivingEntityRenderer.setupRotations' death and upside-down turns, as in vanilla (they used to come before).
  • HumanoidModel.setupSwimAnimation: the 26-unit arm stroke (the left arm through rotLerpRad, the right through lerp, as vanilla does), head down to -45 degrees, and the flutter kick. Arms stay put while an item is used, and the swinging arm is skipped (currentSwing.hand().asArm).

Vanilla reference

LivingEntity.updateSwimAmount / getSwimAmount / isVisuallySwimming, AvatarRenderer.setupRotations, HumanoidModel.setupAnim / setupSwimAnimation, HumanoidMobRenderer.extractRenderState (26.3 sources). No harness renders the player model's pose. A unit test pins the stroke, head and kick, and I checked it in game (below).

Self-check

One integration commit of this PR with #690 and #691, on origin/main 5d027877 (Mac mini):

cargo fmt --all --check                                     ok
cargo clippy --workspace --all-targets -- -D warnings       ok
cargo test -p horizon-client --lib                          806 passed, 0 failed (11 ignored)
python3 tools/parity.py --changed origin/main               86/86 affected harnesses pass, 0 failed

Screenshots

In game (offscreen on the Mac mini, horizon-ctl screenshot, survival water breathing, sprint-swimming forward): from behind, the body lies flat with the arms mid-stroke, then spread at the sides one frame later. From the front, the head leads with the body behind it. Before this, the same views showed the player standing upright in the water.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/689 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/swim-pose` --- ### 📝 Commits (1) - [`c7ad9b8`](https://github.com/horizon-rust/horizon/commit/c7ad9b861fea6746cba412b1cf532c8e834edc33) Swimming pose and stroke on the player model ### 📊 Changes **4 files changed** (+221 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/perspective.rs` (+11 -0) 📝 `crates/horizon-client/src/mobs.rs` (+33 -0) 📝 `crates/horizon-client/src/mobs/anim.rs` (+152 -0) 📝 `crates/horizon-client/src/mobs/render.rs` (+25 -11) </details> ### 📄 Description ## What and why Fixes #535. Fixes #534. Sprint-swimming itself already worked: in game on main, 3 s of sprint-swimming covers 10 blocks against 5.5 without sprint, and the player drops to the swimming box (eye 0.4). The `swimming` / `player_travel` harnesses cover the state and the speed. What was missing is the pose on the model. The third-person player (and the inventory preview) was drawn upright and walking, so it looked like no swimming happened. Crawling under a one-block gap had the same problem. - `LivingEntity.updateSwimAmount`: `swimAmount` eases 0.09 a tick toward `isVisuallySwimming` (the SWIMMING pose, or FALL_FLYING after a glide ended), interpolated per frame (`getSwimAmount`). - `AvatarRenderer.setupRotations`: the body tips forward by `lerp(swimAmount, 0, isInWater ? -90 - xRot : -90)` and, in the swimming pose, moves `(0, -1, 0.3)` along the swimming box. These avatar rotations now come after `LivingEntityRenderer.setupRotations`' death and upside-down turns, as in vanilla (they used to come before). - `HumanoidModel.setupSwimAnimation`: the 26-unit arm stroke (the left arm through `rotLerpRad`, the right through `lerp`, as vanilla does), head down to -45 degrees, and the flutter kick. Arms stay put while an item is used, and the swinging arm is skipped (`currentSwing.hand().asArm`). ## Vanilla reference `LivingEntity.updateSwimAmount` / `getSwimAmount` / `isVisuallySwimming`, `AvatarRenderer.setupRotations`, `HumanoidModel.setupAnim` / `setupSwimAnimation`, `HumanoidMobRenderer.extractRenderState` (26.3 sources). No harness renders the player model's pose. A unit test pins the stroke, head and kick, and I checked it in game (below). ## Self-check One integration commit of this PR with #690 and #691, on origin/main 5d027877 (Mac mini): ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client --lib 806 passed, 0 failed (11 ignored) python3 tools/parity.py --changed origin/main 86/86 affected harnesses pass, 0 failed ``` ## Screenshots In game (offscreen on the Mac mini, `horizon-ctl screenshot`, survival water breathing, sprint-swimming forward): from behind, the body lies flat with the arms mid-stroke, then spread at the sides one frame later. From the front, the head leads with the body behind it. Before this, the same views showed the player standing upright in the water. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:58:39 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2733
No description provided.