[PR #5412] [MERGED] Native mods: native_camera_shake lets a client mod shake the camera #6270

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5412
Author: @Vaspyyy
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: feat/native-camera-shake


📝 Commits (10+)

  • 4983ade Native mods: native_camera_shake lets a client mod shake the camera
  • 39755f9 Native mods and shader packs: native_shader_params hands a mod's pack eight values
  • de92159 Native mods: native_spawn_falling_block throws a block from a server mod
  • 46598a2 Native mods: native_play_local_sound plays a client mod's sound, later
  • d356420 Merge main into feat/native-shader-params
  • 1ec53c7 Merge remote-tracking branch 'upstream/main' into feat/native-falling-blocks
  • a209fab Native hooks: finite keeps its own doc comment
  • f58fe06 Native hooks: finite keeps its own doc comment
  • 6b5780b Merge remote-tracking branch 'upstream/main' into feat/native-camera-shake
  • a844d55 Merge main into #5409

📊 Changes

16 files changed (+435 additions, -4 deletions)

View changed files

📝 crates/horizon-client-render/src/audio.rs (+12 -2)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+1 -0)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+2 -0)
📝 crates/horizon-client/src/game.rs (+1 -0)
📝 crates/horizon-client/src/game/fov.rs (+1 -0)
➕ crates/horizon-client/src/game/native_falling.rs (+130 -0)
📝 crates/horizon-client/src/game/native_hooks.rs (+202 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+1 -0)
📝 crates/horizon-shader-api/src/inputs.rs (+7 -2)
📝 docs/api/shaders-reference.md (+1 -0)
📝 docs/api/shaders.md (+2 -0)
📝 docs/native-mods.md (+42 -0)
➕ tools/native-hook-fragments/native_camera_shake.json (+10 -0)
➕ tools/native-hook-fragments/native_falling_block.json (+8 -0)
➕ tools/native-hook-fragments/native_local_sound.json (+5 -0)
➕ tools/native-hook-fragments/native_shader_params.json (+10 -0)

📄 Description

Requested by Ransom · project thread

🤖 Opened by Vaspyyy's AI agent (Claude Code, Claude Opus 5.5), not by Vaspyyy personally.

What and why

A client hook, native_camera_shake(partial, shake), asked each frame for turns in degrees (pitch, yaw, roll) and an offset in blocks along the camera's right, up and back. Mods add to it, so two mods' shakes add up. Horizon scales the sum by Distortion Effects (screenEffectScale; 0% turns it off), bounds it to 10 degrees and half a block on each axis, and multiplies it into the view after the hurt tilt and view bobbing (bob_matrix). It changes only what the player sees, not where they are or aim.

For impacts, explosions, vehicles and earthquakes in mods.

Kind

  • feature: something new for players (listed under New in the release notes)

Vanilla reference

Horizon-only. It sits after GameRenderer.bobHurt and bobView in the pose multiplied into the projection.

Other projects' code

none

Self-check

Run from the fork against upstream/main (d30588e), Rust 1.97:

cargo fmt -p horizon-client: clean
cargo test -p horizon-client --bin horizon-client shake: pass
cargo clippy -p horizon-client --bins --tests -- -D warnings -A clippy::manual_range_contains: pass
  (the allow is for horizon-world/src/worldgen/aquifer/noise_based.rs:476, a lint new in Rust 1.97 that fails on main too)

All six artillery hook branches (explode, camera shake, falling blocks, entities, shader values, local sounds) were also merged together with tools/stamp_native_hooks.py run locally (not committed) and their tests run there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XnU6QSxLfzUbudHhcvZtgy


🔄 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/5412 **Author:** [@Vaspyyy](https://github.com/Vaspyyy) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-camera-shake` --- ### 📝 Commits (10+) - [`4983ade`](https://github.com/horizon-rust/horizon/commit/4983adec8bd7924f8d3e476fb1b48556afb9046e) Native mods: native_camera_shake lets a client mod shake the camera - [`39755f9`](https://github.com/horizon-rust/horizon/commit/39755f90ff4e2b9b54162bf7d3e8e6440b6fde7d) Native mods and shader packs: native_shader_params hands a mod's pack eight values - [`de92159`](https://github.com/horizon-rust/horizon/commit/de92159b98dfbb9ba0c4fc7317c75d49190a8019) Native mods: native_spawn_falling_block throws a block from a server mod - [`46598a2`](https://github.com/horizon-rust/horizon/commit/46598a2bc52ac26151a20a2e55688d7b36862639) Native mods: native_play_local_sound plays a client mod's sound, later - [`d356420`](https://github.com/horizon-rust/horizon/commit/d356420e7613a751015a5de5c07030ff8439b7ff) Merge main into feat/native-shader-params - [`1ec53c7`](https://github.com/horizon-rust/horizon/commit/1ec53c7a3f2009cdc8739dfb2d56436ea0e4b868) Merge remote-tracking branch 'upstream/main' into feat/native-falling-blocks - [`a209fab`](https://github.com/horizon-rust/horizon/commit/a209fab13eab95be14ebba8f91b98718318a76f3) Native hooks: finite keeps its own doc comment - [`f58fe06`](https://github.com/horizon-rust/horizon/commit/f58fe06685a562cc8fbcdedd6b6bf8e5c542bf34) Native hooks: finite keeps its own doc comment - [`6b5780b`](https://github.com/horizon-rust/horizon/commit/6b5780b686f7f81b9bbc83c20d7528be035afca7) Merge remote-tracking branch 'upstream/main' into feat/native-camera-shake - [`a844d55`](https://github.com/horizon-rust/horizon/commit/a844d558153f562ee61afe38fffb31005c11e319) Merge main into #5409 ### 📊 Changes **16 files changed** (+435 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/audio.rs` (+12 -2) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+1 -0) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+2 -0) 📝 `crates/horizon-client/src/game.rs` (+1 -0) 📝 `crates/horizon-client/src/game/fov.rs` (+1 -0) ➕ `crates/horizon-client/src/game/native_falling.rs` (+130 -0) 📝 `crates/horizon-client/src/game/native_hooks.rs` (+202 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+1 -0) 📝 `crates/horizon-shader-api/src/inputs.rs` (+7 -2) 📝 `docs/api/shaders-reference.md` (+1 -0) 📝 `docs/api/shaders.md` (+2 -0) 📝 `docs/native-mods.md` (+42 -0) ➕ `tools/native-hook-fragments/native_camera_shake.json` (+10 -0) ➕ `tools/native-hook-fragments/native_falling_block.json` (+8 -0) ➕ `tools/native-hook-fragments/native_local_sound.json` (+5 -0) ➕ `tools/native-hook-fragments/native_shader_params.json` (+10 -0) </details> ### 📄 Description <!-- claude-projects-attribution: {"github_login":"Vaspyyy"} --> _Requested by **Ransom** · [project thread](https://claude.ai/code/project/chan_014LE6qsPXZ5YJ26HjaADSTZ?thread=cmsg_014LE6qsPXZ5YJ26HjaADSTZ1T4cmgL2QQ21WRYQVKMdRd)_ > 🤖 Opened by Vaspyyy's AI agent (Claude Code, Claude Opus 5.5), not by Vaspyyy personally. ## What and why A client hook, `native_camera_shake(partial, shake)`, asked each frame for turns in degrees (pitch, yaw, roll) and an offset in blocks along the camera's right, up and back. Mods add to it, so two mods' shakes add up. Horizon scales the sum by Distortion Effects (`screenEffectScale`; 0% turns it off), bounds it to 10 degrees and half a block on each axis, and multiplies it into the view after the hurt tilt and view bobbing (`bob_matrix`). It changes only what the player sees, not where they are or aim. For impacts, explosions, vehicles and earthquakes in mods. ## Kind - [x] feature: something new for players (listed under New in the release notes) ## Vanilla reference Horizon-only. It sits after `GameRenderer.bobHurt` and `bobView` in the pose multiplied into the projection. ## Other projects' code none ## Self-check Run from the fork against `upstream/main` (d30588e), Rust 1.97: ``` cargo fmt -p horizon-client: clean cargo test -p horizon-client --bin horizon-client shake: pass cargo clippy -p horizon-client --bins --tests -- -D warnings -A clippy::manual_range_contains: pass (the allow is for horizon-world/src/worldgen/aquifer/noise_based.rs:476, a lint new in Rust 1.97 that fails on main too) ``` All six artillery hook branches (explode, camera shake, falling blocks, entities, shader values, local sounds) were also merged together with `tools/stamp_native_hooks.py` run locally (not committed) and their tests run there. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XnU6QSxLfzUbudHhcvZtgy --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:17:00 +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#6270
No description provided.