1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! The rigid-body simulation, and the driver that runs it over a world.
//!
//! Two halves that stay apart all the way down. The simulation is the solver:
//! the shapes, body parameters, joints, layer masks, and step results that
//! cross the boundary between a caller and the [`Simulation`], plus the
//! [`PhysicsBudget`] a world reserves its bodies against. Everything crossing
//! that boundary is plain data in the engine's `[f32; 3]` and Euler-degree
//! representation, addressed by an opaque [`BodyHandle`]. That is what lets the
//! simulation hold whatever math types it likes without those types reaching a
//! caller, and it names no engine domain type in either direction.
//!
//! The driver around it builds a simulation from the world's physics content at
//! init, steps it on the fixed tick, and writes the results back as component
//! data: prop bodies, character rigs, probes, contact shaping, and layer
//! resolution. Where a module holds both halves they sit in separate files,
//! never one.
//!
//! Nothing here reads a clock, a file, or a device. The one thing only a host
//! can supply is threads, which it lends through [`PhysicsFanout`]; a world
//! with none steps on the calling thread.
// What the simulation reserves for a world, derived from the counts the world
// is measured by, and the ledger row reporting it.
// The move input a character rig is driven by and the result it reports.
// Contact-event shaping: per-frame batching and the per-pair refractory.
// The authored assets turned into the simulation's shapes and parameters.
// What a step reports back: contact, ray, and sensor crossings.
// What a step hands out as independent work, and the seam a host lends its
// threads through.
// The opaque body identity a caller addresses the simulation by.
// The sorted lookup containers the driver's indices are kept in.
// Prev/curr pose snapshots blended by the frame's accumulator alpha.
// The constraints two bodies can be tied together by, and their motors.
// The membership/filter bit pair, and the named layers resolved onto it.
// Raycast probe answering for animation IK and the follow camera.
// Prop bodies with their handle -> entity and tracked-entity indices.
// Root-motion character rigs: one kinematic capsule per `CharacterRig`.
// The solver: broadphase, narrowphase, islands, contacts, joints, CCD.
// The system that builds and steps the simulation from the world's bodies,
// driven by an optional `PhysicsConfig`.
// The world's floor: the heightfield collider and the noise it is sampled from.
// The collider shapes and dynamic body parameters a caller builds bodies from.
pub use ;
pub use ;
pub use ;
pub use ;
pub use BodyHandle;
pub use ;
pub use LayerMask;
pub use ;
pub use PhysicsSystem;
pub use ;
/// Acceleration due to gravity in world units per second squared. Shared with
/// the third-person controller so its jump takeoff matches the rig's fall.
pub const GRAVITY: f32 = 20.0;