Commit e2d4baa
committed
feat(physics): add rigid-body rotation tracking (entity-based)
Addresses erematorg#145 (partial - entity backend only)
**SCOPE**: Entity-based rigid body rotation for non-continuum objects
(cameras, UI elements, large non-deformable bodies). Continuum matter
will use MPM (Material Point Method) when implemented.
**Added:**
- MomentOfInertia component (rigid body inertia)
- AppliedTorque component (torque application)
- integrate_torques system (τ = I·α integration)
- RotationalWorkEvent (feeds energy ledger)
- Helper functions: calculate_angular_momentum, calculate_rotational_kinetic_energy
- ForcesDiagnostics now tracks angular momentum + rotational KE
- Tests for all rotational physics formulas
**Architecture:**
- Entity backend: Uses components (MomentOfInertia, AppliedTorque)
- MPM backend (future): Will compute L = Σ(r × m·v) from particles
- Both backends feed same energy ledger for unified conservation
**TODO (MPM):**
- MPM particle-based angular momentum computation
- MPM rotational work tracking from grid interactions
- Aggregate diagnostics across both backends1 parent f441ad5 commit e2d4baa
3 files changed
Lines changed: 449 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
300 | 328 | | |
301 | 329 | | |
302 | 330 | | |
| |||
319 | 347 | | |
320 | 348 | | |
321 | 349 | | |
322 | | - | |
| 350 | + | |
| 351 | + | |
323 | 352 | | |
324 | 353 | | |
325 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
0 commit comments