Skip to content

Port box3d dfa5e6a: Fixing issues (#94)#6

Merged
rowan-claude merged 1 commit into
mainfrom
port/box3d-dfa5e6a
Jul 20, 2026
Merged

Port box3d dfa5e6a: Fixing issues (#94)#6
rowan-claude merged 1 commit into
mainfrom
port/box3d-dfa5e6a

Conversation

@rowan-claude

Copy link
Copy Markdown
Contributor

Ports upstream commit dfa5e6add08be96aa1380220aff769b6816d1f69 — "Fixing issues (#94)" (erincatto/box3d) — re-expressed in Q48.16 fixed point where needed.

Engine changes

  • Compound child contact materials (upstream issue #69): b3UpdateContact now feeds the struck child's material to the friction/restitution mixing callbacks instead of material table entry 0. New regression TestCompoundContactMaterials (sphere/capsule/hull children), verified red pre-fix.
  • Triangle-vs-hull ghost collisions: face admission is now faceQueryB.separation >= faceQueryA.separation (the linearSlop bias is gone). This is the one solver-affecting change — determinism goldens regenerated for both builds (WavePile 0xB2784280 narrow / 0x95D6FBC0 ludicrous, MeshDrop 0x777F3CB6 / 0xEE4D0F7A; all sleep steps, the ragdoll goldens, and QuerySpawn carried over unchanged — only hull-on-mesh scenes move).
  • b3SurfaceMaterial gains the explicit uint32_t padding field; compound.c asserts sizeof == 64 (fixed-point layout; upstream asserts 40) and padding == 0 in the dedup hash/compare. b3StageMaterial keeps staging, so the invariant holds by construction.
  • b3DebugDraw.DrawShapeFcn returns void; drawAnchorA is bool.
  • B3_ENABLE_ASSERT for RelWithDebInfo applies to all compilers (was MSVC-only); the mingw CI job moves Debug → RelWithDebInfo; mingw CMake presets added.

Samples

  • CharacterMover extracted to mover.h/mover.cpp with upstream's behavior fixes in fixed point (stop clause zeroes x/z, friction scales horizontal components only, pogo suppressed while airborne-up, forward normalized).
  • Kinematic transparency draw option; SetTransparentKinematic replaces GetTransparentDynamic.
  • New GMod Wheel Stack issues sample (317 verts B3_FIX-wrapped, hull creation null-guarded for fixed-point quickhull). TriangleAndHull manifold repro updated.

Deliberate deviations

  • Already satisfied: upstream's per-lane pointCounts + max-point solver loops — Fixed3D's maxPointCount wide-constraint field has bounded warm start/solve/restitution since the c37cfe4-era Round 2 work.
  • Not ported: the README "Windows MinGW" build line (the slimmed README has no presets section).

Verification

  • All 22 suites pass in Release AND Debug+B3_VALIDATE+ASan/UBSan, in BOTH the narrow and BOX3D_LUDICROUS_MODE builds (goldens bit-identical across 1-4 workers).
  • conversion_audit.py clean across all 103 TUs.
  • Headless sample smoke (mover, compound, manifold, wheel stack) exit 0.

…isions, void DrawShapeFcn

Ports upstream dfa5e6add08be96aa1380220aff769b6816d1f69 "Fixing issues (#94)"
(erincatto/box3d), re-expressed in Q48.16 fixed point where needed.

Engine:
- contact.c: compound child contacts feed the STRUCK child's material to the
  mixing callbacks (was material table entry 0). Regression
  TestCompoundContactMaterials, verified red pre-fix.
- triangle_manifold.c: hull-face admission vs triangle loosened to
  faceQueryB.separation >= faceQueryA.separation (linearSlop bias dropped)
  to reduce ghost collisions. Goldens regenerated for both builds:
  WavePile 0xB2784280 narrow / 0x95D6FBC0 ludicrous, MeshDrop 0x777F3CB6 /
  0xEE4D0F7A; sleep steps, ragdoll, and QuerySpawn all carried unchanged.
- types.h: b3SurfaceMaterial gains explicit uint32_t padding (compound.c
  asserts sizeof == 64 in fixed point — upstream asserts 40 — plus
  padding == 0 in hash/compare); DrawShapeFcn returns void; drawAnchorA bool.
- B3_ENABLE_ASSERT genexp moved out of the MSVC block (all RelWithDebInfo
  builds carry live asserts); mingw CI job Debug -> RelWithDebInfo; mingw
  CMake presets added.

Samples:
- CharacterMover extracted to mover.h/mover.cpp with upstream's behavior
  fixes in fixed point: stop clause zeroes x/z (not x/y), friction scales
  horizontal components only, pogo suppressed while moving up, forward
  normalized after flattening.
- Kinematic transparency option (SetTransparentKinematic, Transparency menu).
- New "GMod Wheel Stack" issues sample (verts B3_FIX-wrapped, hull creation
  null-guarded). TriangleAndHull scenario updated to upstream's new repro.

Already satisfied: the contact_solver.c per-lane pointCounts change — our
maxPointCount wide-constraint field has bounded those loops since the
c37cfe4-era Round 2 work. Not ported: the README MinGW line (the slimmed
README has no presets section).

Verified: all 22 suites in Release and Debug+VALIDATE+ASan/UBSan, narrow AND
ludicrous; conversion_audit.py clean (103 TUs); headless sample smoke exit 0.
@rowan-claude
rowan-claude merged commit 051c0a2 into main Jul 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant