@woosh/meep-engine 2.143.0 → 2.144.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/package.json +1 -1
  2. package/src/core/geom/3d/shape/PointShape3D.d.ts +1 -0
  3. package/src/core/geom/3d/shape/PointShape3D.d.ts.map +1 -1
  4. package/src/core/geom/3d/shape/PointShape3D.js +11 -0
  5. package/src/core/geom/3d/shape/SphereShape3D.d.ts +1 -0
  6. package/src/core/geom/3d/shape/SphereShape3D.d.ts.map +1 -1
  7. package/src/core/geom/3d/shape/SphereShape3D.js +4 -0
  8. package/src/engine/control/first-person/DESIGN_COLLISION.md +264 -217
  9. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +91 -58
  10. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
  11. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1814 -1789
  12. package/src/engine/control/first-person/TODO.md +17 -32
  13. package/src/engine/control/first-person/collision/KinematicMover.d.ts +176 -0
  14. package/src/engine/control/first-person/collision/KinematicMover.d.ts.map +1 -0
  15. package/src/engine/control/first-person/collision/KinematicMover.js +424 -0
  16. package/src/engine/control/first-person/prototype_first_person_controller.js +65 -0
  17. package/src/engine/graphics/render/buffer/simple-fx/ao/SAOShader.js +18 -9
  18. package/src/engine/physics/PLAN.md +94 -32
  19. package/src/engine/physics/contact/ManifoldStore.d.ts +28 -2
  20. package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
  21. package/src/engine/physics/contact/ManifoldStore.js +37 -3
  22. package/src/engine/physics/contact/combine_material.d.ts +30 -0
  23. package/src/engine/physics/contact/combine_material.d.ts.map +1 -0
  24. package/src/engine/physics/contact/combine_material.js +35 -0
  25. package/src/engine/physics/ecs/Collider.d.ts +15 -0
  26. package/src/engine/physics/ecs/Collider.d.ts.map +1 -1
  27. package/src/engine/physics/ecs/Collider.js +34 -0
  28. package/src/engine/physics/ecs/Joint.d.ts +18 -0
  29. package/src/engine/physics/ecs/Joint.d.ts.map +1 -1
  30. package/src/engine/physics/ecs/Joint.js +70 -0
  31. package/src/engine/physics/ecs/PhysicsSystem.d.ts +9 -4
  32. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  33. package/src/engine/physics/ecs/PhysicsSystem.js +9 -4
  34. package/src/engine/physics/ecs/RigidBody.d.ts +15 -0
  35. package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -1
  36. package/src/engine/physics/ecs/RigidBody.js +46 -0
  37. package/src/engine/physics/narrowphase/compute_penetration.d.ts +41 -41
  38. package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -1
  39. package/src/engine/physics/narrowphase/compute_penetration.js +96 -169
  40. package/src/engine/physics/narrowphase/narrowphase_step.d.ts +52 -0
  41. package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
  42. package/src/engine/physics/narrowphase/narrowphase_step.js +130 -3
  43. package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
  44. package/src/engine/physics/solver/solve_contacts.js +10 -21
@@ -286,25 +286,11 @@ function inv_mass_of(rb) {
286
286
  return rb.mass > 0 ? 1 / rb.mass : 0;
287
287
  }
288
288
 
289
- /**
290
- * Combine two friction coefficients (geometric mean Bullet / PhysX default).
291
- * @param {number} a
292
- * @param {number} b
293
- * @returns {number}
294
- */
295
- function combine_friction(a, b) {
296
- return Math.sqrt(a * b);
297
- }
298
-
299
- /**
300
- * Combine two restitution coefficients (maximum — Unity / common default).
301
- * @param {number} a
302
- * @param {number} b
303
- * @returns {number}
304
- */
305
- function combine_restitution(a, b) {
306
- return a > b ? a : b;
307
- }
289
+ // Friction / restitution are no longer combined here: the narrowphase combines
290
+ // the specific source-collider pair's coefficients per contact (so compound
291
+ // bodies with mixed-material colliders are honoured) and stores the result in
292
+ // the manifold (CONTACT_STRIDE offsets 14 / 15). prepare_contacts reads them
293
+ // per contact. See engine/physics/contact/combine_material.js.
308
294
 
309
295
  const scratch_clamp = new Float64Array(2);
310
296
  const scratch_inertia_a = new Float64Array(3);
@@ -520,8 +506,6 @@ export function prepare_contacts(manifolds, system, dt_sub) {
520
506
 
521
507
  const cc = manifolds.contact_count(slot);
522
508
  const slot_off = manifolds.slot_data_offset(slot);
523
- const restitution_combined = combine_restitution(colA.restitution, colB.restitution);
524
- const friction_combined = combine_friction(colA.friction, colB.friction);
525
509
 
526
510
  const pAx = trA.position.x, pAy = trA.position.y, pAz = trA.position.z;
527
511
  const pBx = trB.position.x, pBy = trB.position.y, pBz = trB.position.z;
@@ -530,6 +514,11 @@ export function prepare_contacts(manifolds, system, dt_sub) {
530
514
  for (let k = 0; k < cc; k++) {
531
515
  const off = slot_off + k * CONTACT_STRIDE;
532
516
 
517
+ // Per-contact combined materials (stamped by the narrowphase from
518
+ // this contact's specific source-collider pair).
519
+ const friction_combined = data[off + 14];
520
+ const restitution_combined = data[off + 15];
521
+
533
522
  const wax = data[off], way = data[off + 1], waz = data[off + 2];
534
523
  const wbx = data[off + 3], wby = data[off + 4], wbz = data[off + 5];
535
524
  const nx = data[off + 6], ny = data[off + 7], nz = data[off + 8];