[PR #2565] [MERGED] Walk turtles at their own pace so their feet stop flailing (#1776) #4431

Closed
opened 2026-11-03 04:17:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2565
Author: @Louistuis
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: fix/turtle-feet


📝 Commits (1)

  • 5b5ebfc Walk turtles at their own pace so their feet stop flailing (#1776)

📊 Changes

2 files changed (+196 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/mobs/control.rs (+4 -1)
📝 crates/horizon-client/src/mobs/turtle.rs (+192 -2)

📄 Description

🤖 Opened by Louis's AI agent (Claude Code), not by Louis personally.

What and why

Fixes #1776. A turtle walking on land spins its feet erratically.

Turtles used the default MoveControl, which sets the speed straight to speedModifier * MOVEMENT_SPEED, which is 0.25 on a stroll. Vanilla gives turtles their own Turtle$TurtleMoveControl:

  • updateSpeed:
    • On land, it halves the speed every tick, never below 0.06.
    • In water, it lifts the turtle by 0.005 and cuts the speed away from home (0.08) and for a baby (0.06).
  • tick:
    • It eases the speed an eighth of the way to the wanted one (Mth.lerp(0.125F, …)).
    • It turns at most 90° a tick, keeps the body facing the head's yaw, and lifts towards the wanted point by the slope of the way there.
    • It never jumps and never resets the operation.

On land the speed settles at 0.08375. Mob.setSpeed also sets zza, and moveRelative scales that input by the speed again, so ground covered per tick goes with the speed squared. A strolling turtle therefore covered about nine times the ground vanilla's does. TurtleModel.setupAnim swings the legs by 8 * walkSpeed at walkPos * 5, so a walk animation fed by that motion spun the feet.

This ports TurtleMoveControl into mobs/turtle.rs, dispatched from Mob::move_control like the rabbit's. control.rs now shares its EPSILON with it.

Not changed here. Swimming still differs from vanilla. Turtle.travelInWater (moveRelative(0.1F), 0.9 drag, and a 0.005 sink when it has no target, unless it is heading home and within 20 blocks of it), TurtlePathNavigation and the turtle goal set aren't ported yet. Turtles keep the generic fluid travel and goals for now.

#2520 is complementary: it fixes the turtle's step sound timing (Turtle.nextStep). This PR fixes its movement.

Vanilla reference

  • Turtle$TurtleMoveControl.tick, Turtle$TurtleMoveControl.updateSpeed
  • Turtle.<init> (installs the control), Mob.setSpeed, Entity.moveRelative
  • TurtleModel.setupAnim, LivingEntity.updateWalkAnimation

Tests. No mob_ai turtle scene yet. Horizon's turtle still runs the generic passive goal set, not Turtle.registerGoals:

  • an extra FloatGoal and RandomLookAroundGoal;
  • PanicGoal at 1.25 instead of TurtlePanicGoal at 1.2;
  • LookAtPlayerGoal with range 6 instead of 8;
  • no TemptGoal, TurtleGoToWaterGoal, TurtleTravelGoal or TurtleRandomStrollGoal.

A scene would diverge on its first random draw for reasons unrelated to this change. Instead, unit tests in mobs::turtle::tests pin vanilla's values. Each fails against the old default MoveControl:

Test Pins
walks_on_land_at_a_third_of_its_movement_speed land speed 0.08375 on every tick, body follows yaw, no jump, operation kept
water_speed_is_cut_away_from_home_and_for_babies +0.005 lift per tick; near home → 0.25, far → 0.10125, baby → 0.08375
stops_when_the_path_is_done_or_the_point_reached speed 0 at path end and at the point; a stopped turtle in water still lifts 0.005
lifts_towards_a_point_above_by_the_slope_of_the_way_there velocity.y == speed * (dy / dist) * 0.1
turns_at_most_ninety_degrees_a_tick_and_wraps_into_a_turn a 90° clamp, then the wrap to the target yaw

CI's parity job runs the harnesses this file can affect (mob_ai, entity_move, entity_model; the last covers TurtleModel.setupAnim). A turtle mob_ai scene becomes possible once the goal set, TurtlePathNavigation and travelInWater are ported.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on MrLouis, against upstream/main at a727f617f, 5 min 55 s)

Check Result
Scope ✅ 2 files, +196 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 320 passed (27 s)
rustfmt ✅ (5 s)
clippy ✅ (45 s)
tests: horizon-client ✅ 1342 passed (3 min 40 s)
doc tests ✅ 0 passed (57 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/2565 **Author:** [@Louistuis](https://github.com/Louistuis) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/turtle-feet` --- ### 📝 Commits (1) - [`5b5ebfc`](https://github.com/horizon-rust/horizon/commit/5b5ebfcce3ecbcae6c9a5811c83ac039f867da32) Walk turtles at their own pace so their feet stop flailing (#1776) ### 📊 Changes **2 files changed** (+196 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/control.rs` (+4 -1) 📝 `crates/horizon-client/src/mobs/turtle.rs` (+192 -2) </details> ### 📄 Description > 🤖 Opened by Louis's AI agent (Claude Code), not by Louis personally. ## What and why Fixes #1776. A turtle walking on land spins its feet erratically. Turtles used the default `MoveControl`, which sets the speed straight to `speedModifier * MOVEMENT_SPEED`, which is 0.25 on a stroll. Vanilla gives turtles their own `Turtle$TurtleMoveControl`: - **`updateSpeed`**: - On land, it halves the speed every tick, never below 0.06. - In water, it lifts the turtle by 0.005 and cuts the speed away from home (0.08) and for a baby (0.06). - **`tick`**: - It eases the speed an eighth of the way to the wanted one (`Mth.lerp(0.125F, …)`). - It turns at most 90° a tick, keeps the body facing the head's yaw, and lifts towards the wanted point by the slope of the way there. - It never jumps and never resets the operation. On land the speed settles at 0.08375. `Mob.setSpeed` also sets `zza`, and `moveRelative` scales that input by the speed again, so ground covered per tick goes with the speed squared. A strolling turtle therefore covered about nine times the ground vanilla's does. `TurtleModel.setupAnim` swings the legs by `8 * walkSpeed` at `walkPos * 5`, so a walk animation fed by that motion spun the feet. This ports `TurtleMoveControl` into `mobs/turtle.rs`, dispatched from `Mob::move_control` like the rabbit's. `control.rs` now shares its `EPSILON` with it. **Not changed here.** Swimming still differs from vanilla. `Turtle.travelInWater` (`moveRelative(0.1F)`, 0.9 drag, and a 0.005 sink when it has no target, unless it is heading home and within 20 blocks of it), `TurtlePathNavigation` and the turtle goal set aren't ported yet. Turtles keep the generic fluid travel and goals for now. #2520 is complementary: it fixes the turtle's step sound timing (`Turtle.nextStep`). This PR fixes its movement. ## Vanilla reference - `Turtle$TurtleMoveControl.tick`, `Turtle$TurtleMoveControl.updateSpeed` - `Turtle.<init>` (installs the control), `Mob.setSpeed`, `Entity.moveRelative` - `TurtleModel.setupAnim`, `LivingEntity.updateWalkAnimation` **Tests.** No `mob_ai` turtle scene yet. Horizon's turtle still runs the generic passive goal set, not `Turtle.registerGoals`: - an extra `FloatGoal` and `RandomLookAroundGoal`; - `PanicGoal` at 1.25 instead of `TurtlePanicGoal` at 1.2; - `LookAtPlayerGoal` with range 6 instead of 8; - no `TemptGoal`, `TurtleGoToWaterGoal`, `TurtleTravelGoal` or `TurtleRandomStrollGoal`. A scene would diverge on its first random draw for reasons unrelated to this change. Instead, unit tests in `mobs::turtle::tests` pin vanilla's values. Each fails against the old default `MoveControl`: | Test | Pins | | --- | --- | | `walks_on_land_at_a_third_of_its_movement_speed` | land speed 0.08375 on every tick, body follows yaw, no jump, operation kept | | `water_speed_is_cut_away_from_home_and_for_babies` | +0.005 lift per tick; near home → 0.25, far → 0.10125, baby → 0.08375 | | `stops_when_the_path_is_done_or_the_point_reached` | speed 0 at path end and at the point; a stopped turtle in water still lifts 0.005 | | `lifts_towards_a_point_above_by_the_slope_of_the_way_there` | `velocity.y == speed * (dy / dist) * 0.1` | | `turns_at_most_ninety_degrees_a_tick_and_wraps_into_a_turn` | a 90° clamp, then the wrap to the target yaw | CI's parity job runs the harnesses this file can affect (`mob_ai`, `entity_move`, `entity_model`; the last covers `TurtleModel.setupAnim`). A turtle `mob_ai` scene becomes possible once the goal set, `TurtlePathNavigation` and `travelInWater` are ported. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on MrLouis, against upstream/main at a727f617f, 5 min 55 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +196 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 320 passed (27 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (45 s) | | tests: horizon-client | ✅ 1342 passed (3 min 40 s) | | doc tests | ✅ 0 passed (57 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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-03 04:17:06 +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#4431
No description provided.