Skip to content

Physics3D: contact-constraint overflow at ~10k bodies makes objects tunnel through static geometry; JoltScene ignores PhysicsSettings limits #523

Closed

Description

@drsnuggles8

Is your feature request related to a problem? Please describe.
At ~10 000 contacting dynamic bodies, Jolt's contact-constraint buffer overflows and bodies silently tunnel through static geometry. The perf stress battery's physics_pile_10000 scene (10k boxes/spheres falling into a walled arena) spams

[error] OloEngine: Jolt physics update error: 4

(4 = EPhysicsUpdateError::ContactConstraintsFull — "Some contacts were ignored. Increase inMaxContactConstraints") and the battery's workload probe caught a body at y = −36 and still falling after 20 s — through the arena's static floor (its collider was valid; the 1k variant of the same scene settles correctly at y ≈ 0.5).

Two config problems compound it:

  1. JoltScene.h hardcodes s_MaxContactConstraints = 10240 (and s_MaxBodies/s_MaxBodyPairs = 65536) as constexpr, so a project cannot raise it.
  2. PhysicsSettings::m_MaxContactConstraints (PhysicsSettings.h:28) exists and is honoured by Physics3DSystem::Init — but JoltScene::Init (JoltScene.cpp:2383) uses its own constants and ignores the settings. The two init paths disagree.

Describe the solution you'd like

  • Route JoltScene init through PhysicsSettings (one source of truth), with defaults sized for the advertised body counts (10240 constraints is far too small for 65536 max bodies).
  • Surface the overflow loudly but throttled (see the FrameDataBuffer log-spam issue): today it's an every-step error line, and the gameplay symptom (objects falling through the world) is disconnected from the cause.

Describe alternatives you've considered

  • Documenting a practical body-count ceiling instead — but 10k dynamic bodies is within Jolt's comfortable range when the buffers are sized for it; the engine shouldn't corrupt the simulation silently.

Additional context
From the perf stress battery (generate_perf_scenes.py --scene physics_pile --count 10000, Dist). At 50k bodies MaxBodies (65536) still fits, but the same overflow applies. Frame cost at 10k was ~1.6 s/frame in Dist (fixed-timestep catch-up spiral) — separate scalability data in the battery findings report.

Score

capability: 3
craft: 3
stability: 5
decay: 1
effort: 2
confidence: 0.9
learning: 2
fun: 3
kano: table-stakes
blocked_by: []
blocks: []

Activity

  1. coderabbitai commented on Jul 3, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #78 - Feature/physics integration [closed]
    #305 - ci(physics): retry flaky PhysicsLayerFilteringTest + harden JoltJobSy… [merged]
    #323 - feat(physics): springy (soft) hinge/slider joint limits via SpringSet… [merged]
    #340 - feat(physics): add CollideConnected toggle for joints (#308 item 1) [merged]
    #468 - feat(physics): wire Jolt HeightFieldShape into terrain collision (#428) [merged]


    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions