[PR #4500] [CLOSED] Walk a camel's legs at its own rate, and only while it stands #5658

Closed
opened 2026-11-03 05:14:07 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4500
Author: @MSedgeMC
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: fix/camel-walk-animation


📝 Commits (1)

  • b76a3b8 Walk a camel's legs at its own rate, and only while it stands

📊 Changes

3 files changed (+86 additions, -11 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+1 -3)
📝 crates/horizon-client/src/mobs/camel.rs (+66 -0)
📝 crates/horizon-client/src/mobs/living.rs (+19 -8)

📄 Description

Fixes the camel half of the walk animation. (No issue; from the port ledger's Camel.updateWalkAnimation row.)

Camel.updateWalkAnimation is walkAnimation.update(target, 0.2f, isBaby() ? 3 : 1) with target = (getPose() == STANDING && !dashAnimationState.isStarted()) ? min(speed * 6.0f, 1.0f) : 0.0f — six times the distance moved rather than the LivingEntity default four, smoothed at 0.2 rather than 0.4, and zero while the camel sits or dashes. Horizon used the default rule for every species but the Creaking, so a walking camel's legs moved at min(d*4,1)*0.4 instead of min(d*6,1)*0.2, and a sitting or dashing camel kept walking on the spot.

The rule now lives in one place, Mob::walk_animation, and both writers call it: the mob tick in mobs/living.rs and the inline copy in game/remote.rs that drives network and server-thread mobs. That second copy had also dropped the Creaking's 25/3 rule, which this corrects as a side effect. The camel state is the two flags Horizon already keeps — camel_sitting (the same field sync::pose_id turns into Pose.SITTING) and flag2 (the dash flag the model's dash animation reads) — so no new fields. The render side was already right (baby ×3, the 1.0 clamp, apply_walk(..., 2.0, 2.5)), and is untouched.

What is proven: cargo test -p horizon-client --lib mobs::camel::tests → 7 passed on a build box. The new tests walk a camel one tick at 0.2 blocks and check the speed is vanilla's (0.2*6).min(1) after the 0.2 smoothing; sit it down for 41 ticks and check the legs settle to zero and stop advancing; dash it and check the same; and keep a cow on the default rule (0.32) so the change cannot leak. All four are data-free, so they run without the prepared resources.

What is not proven: nothing ran in a game — the visible result (a camel's stride while ridden, and legs freezing when it sits) has not been watched; pr_ready was not run on this branch, so CI's verify is the workspace check.

One assumption worth flagging for review: the camel gate uses camel::is_camel, so a Camel Husk takes the same rule, which assumes CamelHusk does not override updateWalkAnimation in 26.3. If it does, the gate narrows to Species::Camel.


🔄 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/4500 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/camel-walk-animation` --- ### 📝 Commits (1) - [`b76a3b8`](https://github.com/horizon-rust/horizon/commit/b76a3b8fff066a547bf06bbb1e30241a5c0d6e52) Walk a camel's legs at its own rate, and only while it stands ### 📊 Changes **3 files changed** (+86 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+1 -3) 📝 `crates/horizon-client/src/mobs/camel.rs` (+66 -0) 📝 `crates/horizon-client/src/mobs/living.rs` (+19 -8) </details> ### 📄 Description Fixes the camel half of the walk animation. (No issue; from the port ledger's `Camel.updateWalkAnimation` row.) `Camel.updateWalkAnimation` is `walkAnimation.update(target, 0.2f, isBaby() ? 3 : 1)` with `target = (getPose() == STANDING && !dashAnimationState.isStarted()) ? min(speed * 6.0f, 1.0f) : 0.0f` — six times the distance moved rather than the `LivingEntity` default four, smoothed at 0.2 rather than 0.4, and zero while the camel sits or dashes. Horizon used the default rule for every species but the Creaking, so a walking camel's legs moved at `min(d*4,1)*0.4` instead of `min(d*6,1)*0.2`, and a sitting or dashing camel kept walking on the spot. The rule now lives in one place, `Mob::walk_animation`, and both writers call it: the mob tick in `mobs/living.rs` and the inline copy in `game/remote.rs` that drives network and server-thread mobs. That second copy had also dropped the Creaking's 25/3 rule, which this corrects as a side effect. The camel state is the two flags Horizon already keeps — `camel_sitting` (the same field `sync::pose_id` turns into `Pose.SITTING`) and `flag2` (the dash flag the model's dash animation reads) — so no new fields. The render side was already right (baby ×3, the 1.0 clamp, `apply_walk(..., 2.0, 2.5)`), and is untouched. **What is proven:** `cargo test -p horizon-client --lib mobs::camel::tests` → 7 passed on a build box. The new tests walk a camel one tick at 0.2 blocks and check the speed is vanilla's `(0.2*6).min(1)` after the 0.2 smoothing; sit it down for 41 ticks and check the legs settle to zero and stop advancing; dash it and check the same; and keep a cow on the default rule (0.32) so the change cannot leak. All four are data-free, so they run without the prepared resources. **What is not proven:** nothing ran in a game — the visible result (a camel's stride while ridden, and legs freezing when it sits) has not been watched; `pr_ready` was not run on this branch, so CI's `verify` is the workspace check. One assumption worth flagging for review: the camel gate uses `camel::is_camel`, so a Camel Husk takes the same rule, which assumes `CamelHusk` does not override `updateWalkAnimation` in 26.3. If it does, the gate narrows to `Species::Camel`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:07 +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#5658
No description provided.