Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: restamp the physics trace to d98b165
Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
  • Loading branch information
cursoragent and lazyxeon committed Oct 21, 2026
commit ca73eba96f7d811bbf65736e9ccdbcefd79378c4
4 changes: 2 additions & 2 deletions docs/architecture/physics.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runtime_edges:
note: "buoyancy (apply_buoyancy_forces, lib.rs:1464) consumes WaterQuery/AnalyticWater"
owns: [astraweave-physics]
doc_version: "1.15"
last_verified_commit: 6c238fc0
last_verified_commit: d98b1657
---

# Architecture Trace: Physics
Expand All @@ -24,7 +24,7 @@ last_verified_commit: 6c238fc0
| **System name** | Physics (Rigid Body Simulation + Subsystems) |
| **Primary crates** | `astraweave-physics` (12 source files / ~31K LoC), wraps `rapier3d 0.22` |
| **Document version** | 1.15 |
| **Last verified against commit** | `6c238fc0` |
| **Last verified against commit** | `d98b1657` |
| **Last verified date** | 2026-10-21 |
| **Status** | **Active core** (`PhysicsWorld` + `CharacterController` + Rapier broadphase) **with feature-gated and dormant subsystems** (async-physics, ECS plugin, in-house SpatialHash). The core rigid-body / character / raycast surface is production-wired through `astraweave-gameplay` and `astraweave-npc`. 1.14: `destruction.rs`, `DestructionManager`, `process_destructible_hits`, and `benches/destruction.rs` are removed. `PhysicsWorld` does not write `DestructionCommand`. `break_destructible` only removes the Rapier body. Fracture lives in `astraweave-destruction` and is not called from `PhysicsWorld`. 1.3: `PhysicsWorld::remove_body` is the shared removal path; `break_destructible` delegates to it. `aravath_runtime` uses it to replace chunk trimeshes. Several subsystems (projectile, ragdoll, vehicle, environment, cloth) are independent managers with rich APIs but limited production wiring. The `SpatialHash` module is **dormant** despite being advertised in the crate doc-comment. |
| **Owner notes** | 1.12 (2026-10-18): `raycast_with_and_without_normal` calls `step()` before casting. The query pipeline is empty until then, so the ground ray missed and the bench exited 101. 1.11 (2026-10-17): `deformed_step` takes `ClimbTick` (flags + tick) so the function stays within Clippy's argument limit. The step body is unchanged. 1.10 (2026-10-17): `[patch.crates-io]` points `rapier3d` at `third_party/rapier3d` (crates.io 0.22). A settled step allocates nothing. Vendoring is the current choice. An in-house physics engine is not planned work. #262 stays open. 1.9 (2026-10-17): `PhysicsWorld::step` no longer follows Rapier's step with a full `QueryPipeline::update`. The workspace patches `rapier3d` 0.22 so the drained modified-collider buffer is returned to the set. `one_physics_step_allocates_nothing` stays at 0 allocs. 1.8 (2026-10-16): `gravity.rs` deleted in #330. #336 is closed. `PhysicsWorld::step` still reads the Rapier vector. Cell acceleration is `gravity_mm_s2`. 1.7 (2026-10-16): delete `gravity.rs` with the local sim (#336). 1.6 (2026-10-16): `GravityManager` stays off `PhysicsWorld::step`. This trace is forensic, not aspirational — it documents what is wired today, not what the doc-comments imply. Scale: 12 source files, 31K LoC, 20 test files, 10 benchmarks, 9 consumer Cargo deps (5 production + 4 examples). **Verification pass 2026-05-12 (version 1.1):** resolved 3 markers — (a) `astraweave-scripting` is a real production consumer that uses `PhysicsWorld` as an ECS resource AND wraps it in a `*const PhysicsWorld` raw pointer via `PhysicsProxy` for Rhai bindings (§4 Downstream row corrected); (b) `PhysicsWorld` IS `Send + Sync` (auto-derived, proven by compile-time obligations of `World::get_resource<T>` — §8 Invariant 18 corrected, previous "Send but NOT Sync" claim was wrong); (c) `process_destructible_hits` has zero callers workspace-wide (closed in §11). Decision Log "[Reasoning not recovered]" markers (8 entries) remain — git log searches returned no physics-specific decision commits. **Deep investigation pass 2026-05-12 (version 1.2):** corrected 4 factual errors and enriched 2 Open Questions. Corrections: (a) the crate has **5 features**, not 3 — `alloc-counter` and `fast-alloc` were missing from §1, §5, Appendix A; (b) `alloc-counter` feature location in §9 was wrong (was "Cargo.toml:67-69 — wait that's astraweave-ai", actually `Cargo.toml:17` + bench gating at `:77-80`); (c) `SpatialHash` test surface in §11 was significantly under-counted (claimed "3 dedicated tests" — actually 20+ tests across 4 files: `behavioral_correctness_tests.rs`, `coverage_boost_tests.rs`, `cross_subsystem_validation.rs`, `spatial_hash_character_tests.rs` with 33 `#[test]` attributes); (d) the claim that "`benches/raycast.rs` mentions spatial-hash patterns" was wrong — zero `SpatialHash` references in any bench file. Enrichments: (a) §11 `ecs` feature question now documents three de facto consumer patterns (direct passthrough / `World::insert_resource` without feature / designed `PhysicsPlugin` with feature) — `astraweave-scripting` uses pattern (b) which sits between the existing two; (b) `SpatialHash` Open Question enriched with comprehensive test surface inventory + "no bench" correction. |
Expand Down
Loading