Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Physics: contact enter/exit hysteresis around the 1 cm contact offset

Aperta
#323 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
game-dev

Direzione di ricerca

Start in BepuEventSink (org.mass4.turian.physics.bepu) where solid contacts are reported, and read PhysicsSettings for configuration. Run the Example 12 box rain bench (headless Release) to measure exit rate, and review WakingASleepingBody_KeepsItsRestingContacts test. Done means a jittering pair gives one Enter and no Exit, exits per second fall well below tracked contacts, and new tests pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

c:engine p:medium size:S t:enhancement

Current State

The Bepu backend (org.mass4.turian.physics.bepu, BepuEventSink) reports a solid contact once the deepest manifold point is within Unity's default 1 cm contact offset, and reports an exit on the first step a tracked pair is tested without reaching it. There is no hysteresis, so pairs whose separation hovers around -1 cm alternate Enter and Exit every few steps.

Measured in Example 12's box rain (headless, Release, 2026-10-24): about 12,000 exits per second against about 6,000 tracked contacts at 6k boxes. Every exit was between two awake bodies, so they come from this boundary flicker rather than sleeping or waking. That rate makes OnCollisionEnter/OnCollisionExit unusable for gameplay wiring such as damage, sounds or "is grounded" state.

Tasks

  • Choose the policy: an exit grace period (keep a pair touching for N steps or T seconds after it was last found within the offset) or a dual threshold (enter within 1 cm, exit only beyond a larger distance, for example 2–3 cm). Compare against Unity/PhysX contact persistence where documented.
  • Implement it in BepuEventSink for solid contacts; decide whether triggers need the same treatment (they use depth ≥ 0 today).
  • Keep the contact points and impulse of a pair held through the grace period consistent (last real manifold or none).
  • Make the threshold or grace configurable through PhysicsSettings if the choice is not obvious.
  • Add tests: a box resting on the ground with tiny vertical jitter gets one enter and no exit; a box lifted clearly away still exits within the configured bound.
  • Re-measure the rain bench's exit rate; update the physics README and changelog.

Acceptance Criteria

  • A resting or gently jittering pair produces a single Enter, Stays, and no spurious Exit.
  • Real separations still exit within the configured grace period or distance.
  • In the 6k-box rain bench, exits per second fall well below the tracked-contact count (target: an order of magnitude fewer than today).
  • Island sleep/wake keeps resting contacts without exits, as covered by WakingASleepingBody_KeepsItsRestingContacts.

Related

  • #64 (physics backend, rigid bodies and collision)
Lingua principale
C#
Stelle
1
Fork
1
Merge medio
2h
PR unite (30g)
35

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MASS4ORG/Turian

Tutte le issue di MASS4ORG/Turian

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.