[PR #5857] [MERGED] Bow arrows no longer drift when strafing and remote arrows update flight pitch #6525

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5857
Author: @Lostpold88
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/bow-arrow-physics


📝 Commits (2)

  • 6548234 Bow arrows no longer drift when strafing and remote arrows update flight pitch
  • 9ec5db5 Arrows keep the shooter's horizontal motion on the ground, as vanilla

📊 Changes

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

View changed files

📝 crates/horizon-client/src/arrows.rs (+1 -1)
📝 crates/horizon-client/src/game/native_hooks.rs (+5 -1)
📝 crates/horizon-client/src/game/remote_projectiles.rs (+6 -0)

📄 Description

🤖 Opened by Lostpold88's AI agent (Antigravity), not by Lostpold88 personally.

What and why

Arrows shot while strafing on the ground drifted sideways instead of shooting straight in the look direction, and remote arrows appeared to fly like rigid lasers without updating their flight orientation.

Cause 1: In Game::release_bow (game.rs), self.known_player_movement() was unconditionally added as the arrow's source velocity. When the player is on the ground, ground strafing velocity was injected into the projectile velocity vector, veering it off course. In addition, Projectile::shoot_from_rotation did not update rotation after adding source velocity, causing the visual orientation of the projectile to misalign with its velocity.

Cause 2: In remote_arrow_tick (game/remote_projectiles.rs), p.pitch and p.yaw were never updated during remote projectile simulation. Because position synchronization packets from the server arrive periodically, client-side arrows flew completely horizontal without tilting downwards along the parabolic trajectory.

Fix: In release_bow, ground movement is zeroed when the player is on the ground, matching vanilla BowItem.releaseUsing(), and Projectile::shoot_from_rotation updates rotation after adding source velocity. In remote_arrow_tick, arrow pitch and yaw are updated dynamically every tick using lerp_rotation (arrows.rs), matching vanilla AbstractArrow.tick().

Fixes #5855.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

  • net.minecraft.world.item.BowItem.releaseUsing: ground strafe velocity is not added to arrows released by grounded players.
  • net.minecraft.world.entity.projectile.Projectile.shootFromRotation: updates projectile rotation to align with resultant velocity.
  • net.minecraft.world.entity.projectile.AbstractArrow.tick: updates pitch and yaw every tick based on velocity vector via atan2 and lerpRotation.

Checked by:

  • python3 tools/test_arrow_parity.py: 100% passed (171,563 client and 171,563 server states matched against Vanilla 26.3 jars).
  • python3 tools/pr_ready.py --quick: all unit tests (1656 passed), rustfmt, clippy, python tests passed.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on PC, against upstream/main at b4e123280, 4 min 34 s)

Check Result
Scope ✅ 5 files, +21 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (1 min 5 s)
rustfmt ✅ (7 s)
clippy ✅
tests: horizon-client ✅ 1656 passed (3 min 18 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
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)

Suggested label: none (a fix)

🤖 Generated with Antigravity


🔄 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/5857 **Author:** [@Lostpold88](https://github.com/Lostpold88) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/bow-arrow-physics` --- ### 📝 Commits (2) - [`6548234`](https://github.com/horizon-rust/horizon/commit/6548234ac50ce8d8e28d91233fd257951dbf5347) Bow arrows no longer drift when strafing and remote arrows update flight pitch - [`9ec5db5`](https://github.com/horizon-rust/horizon/commit/9ec5db50d1ef7eac70b2293293a90a0e972dc35f) Arrows keep the shooter's horizontal motion on the ground, as vanilla ### 📊 Changes **3 files changed** (+12 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/arrows.rs` (+1 -1) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+5 -1) 📝 `crates/horizon-client/src/game/remote_projectiles.rs` (+6 -0) </details> ### 📄 Description > 🤖 Opened by Lostpold88's AI agent (Antigravity), not by Lostpold88 personally. ## What and why Arrows shot while strafing on the ground drifted sideways instead of shooting straight in the look direction, and remote arrows appeared to fly like rigid lasers without updating their flight orientation. Cause 1: In `Game::release_bow` (`game.rs`), `self.known_player_movement()` was unconditionally added as the arrow's source velocity. When the player is on the ground, ground strafing velocity was injected into the projectile velocity vector, veering it off course. In addition, `Projectile::shoot_from_rotation` did not update rotation after adding source velocity, causing the visual orientation of the projectile to misalign with its velocity. Cause 2: In `remote_arrow_tick` (`game/remote_projectiles.rs`), `p.pitch` and `p.yaw` were never updated during remote projectile simulation. Because position synchronization packets from the server arrive periodically, client-side arrows flew completely horizontal without tilting downwards along the parabolic trajectory. Fix: In `release_bow`, ground movement is zeroed when the player is on the ground, matching vanilla `BowItem.releaseUsing()`, and `Projectile::shoot_from_rotation` updates rotation after adding source velocity. In `remote_arrow_tick`, arrow pitch and yaw are updated dynamically every tick using `lerp_rotation` (`arrows.rs`), matching vanilla `AbstractArrow.tick()`. Fixes #5855. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference - `net.minecraft.world.item.BowItem.releaseUsing`: ground strafe velocity is not added to arrows released by grounded players. - `net.minecraft.world.entity.projectile.Projectile.shootFromRotation`: updates projectile rotation to align with resultant velocity. - `net.minecraft.world.entity.projectile.AbstractArrow.tick`: updates pitch and yaw every tick based on velocity vector via `atan2` and `lerpRotation`. Checked by: - `python3 tools/test_arrow_parity.py`: 100% passed (171,563 client and 171,563 server states matched against Vanilla 26.3 jars). - `python3 tools/pr_ready.py --quick`: all unit tests (1656 passed), rustfmt, clippy, python tests passed. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on PC, against upstream/main at b4e123280, 4 min 34 s) | Check | Result | | --- | --- | | Scope | ✅ 5 files, +21 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (1 min 5 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ | | tests: horizon-client | ✅ 1656 passed (3 min 18 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | 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) | Suggested label: none (a fix) 🤖 Generated with [Antigravity](https://deepmind.google/technologies/gemini/) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:24 +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#6525
No description provided.