r/rust_gamedev • u/pockerhead • 5h ago
oxijolt update: prebuilt binaries, wasm32 and batch body ops (safe Jolt Physics bindings for Rust)
A month and a half ago I posted oxijolt 1.0 here, safe Rust bindings to Jolt Physics 5.6. Since then it got six minor releases, so a short update on what changed.
Prebuilt binaries. The biggest practical one. Until now the crate compiled Jolt from source, which meant CMake and a C++ toolchain on every machine. Since 1.2 the build script downloads a prebuilt static library for your target and checks it against a sha256 recorded in the crate. Falls back to building from source if nothing matches. Windows (MSVC), Linux (glibc 2.35+), macOS (aarch64).
wasm32. As of 1.6 there is a prebuilt target for wasm32-unknown-unknown, so browser builds work without a local emscripten dance. This was the most requested thing after 1.0.
Batch body operations. Creating or removing bodies one by one takes a broad-phase update per body. New add_bodies / remove_bodies do it in one batch with a single broad-phase subtree build, in deterministic id order. Plus create_body_detached if you want to prepare bodies before they enter the world.
Live character tuning. CharacterMut can now change settings on a live character (mass, slope angle, shape, supporting volume and more) without recreating it and losing contacts and ids. set_shape even tests whether the new shape fits and refuses if it does not.
Queries. cast_ray_all and cast_shape_all return every hit sorted by fraction, not just the closest one. QueryFilter::body_filter takes a closure over BodyId, so you can filter bodies inline in any query.
Plus a pile of smaller things: deactivate_bodies (put a list of bodies to sleep in one call), Shape::mass_properties, Shape::local_bounds, active_body_states for reading all awake bodies under one lock.
Everything keeps the same rules as 1.0: every call validates its inputs, errors change nothing, and the determinism tests still pass bit for bit across thread counts.
Where it runs in practice: my minesweeper-on-a-living-sea game (posted here earlier) uses oxijolt in the browser build, buoyancy and all, on wasm32. Playable at https://pockerhead.github.io/rune-minesweeper/, source at https://github.com/pockerhead/rune-minesweeper
And a teaser: I'm building a showcase game around the library, a city sandbox with destructible buildings (video attached, that's real Jolt debris, not baked animation). The destruction and buoyancy systems from it will ship as a Bevy plugin, fully open source on GitHub.
Crate: https://crates.io/crates/oxijolt Repo: https://github.com/pockerhead/oxijolt
If you tried it after the 1.0 post, I'd like to hear what broke or what is missing. The issue tracker is open and half of these features came from it.