Fix mesh-convex margin candidate query#2916
Conversation
Use the full margin plus gap contact envelope when querying mesh triangle candidates for convex contacts. This keeps the mesh midphase consistent with broad phase expansion and final contact acceptance, preventing valid margin-shell contacts from being culled before narrow phase processing. Add a CUDA regression test where a sphere is separated from a mesh by more than gap but less than margin plus gap.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR unifies gap and per-shape margins into a single contact_threshold used by mesh- and heightfield-midphase queries; the midphase API and BVH preprocessing were updated, narrow-phase triangle culling supplies the combined threshold, and tests plus a changelog entry were added. ChangesMesh–Convex Margin-Shell Contact Generation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
I think the bugfix is correct. But can you double check - it's very likely that the heightfield code has the same problem. |
Use the full margin plus gap contact envelope when querying heightfield cells for convex contacts. This keeps heightfield midphase candidate generation consistent with broad phase expansion and final contact acceptance. Add a CUDA regression covering a sphere just outside a heightfield lateral edge, where the surface separation is larger than gap but still inside the margin shell.
Description
Fix mesh-vs-convex and heightfield-vs-convex midphase candidate generation to query candidates using the full
margin + gapcontact envelope, not justgap.This keeps the mesh BVH query and heightfield grid-cell lookup consistent with broad-phase AABB expansion and final contact acceptance. Without this, valid margin-shell contacts can be culled before narrow phase processing.
Checklist
CHANGELOG.mdhas been updated (if user-facing change)Test plan
Bug fix
Steps to reproduce:
margin=0.02,gap=0.005.0.03.0.03 <= margin_a + margin_b + gap_a + gap_b.The heightfield regression covers the lateral edge case where grid-cell candidate lookup can cull the contact before narrow phase. Vertical margin-shell contacts above the heightfield already reached narrow phase because the grid lookup is driven by XY cell overlap.
Minimal reproduction:
Summary by CodeRabbit