Skip to content

Fix duplicate margin in cached polyhedral AABBs - #4803

Open
tianrking wants to merge 1 commit into
bulletphysics:masterfrom
tianrking:codex/fix-polyhedral-aabb-margin
Open

Fix duplicate margin in cached polyhedral AABBs#4803
tianrking wants to merge 1 commit into
bulletphysics:masterfrom
tianrking:codex/fix-polyhedral-aabb-margin

Conversation

@tianrking

Copy link
Copy Markdown

Fixes #4694

Problem

btPolyhedralConvexAabbCachingShape::recalcLocalAabb() stores support bounds with the collision margin already applied. Both the virtual and nonvirtual AABB paths then pass the current margin to btTransformAabb, expanding the bounds a second time. Caching the margin also lets a later setMargin() combine a stale cached value with the new one.

Change

  • Cache only the no-margin polyhedral support bounds.
  • Continue applying the current margin when transforming the cached bounds.
  • Add a btConvexHullShape regression covering the virtual path, the nonvirtual path, a runtime margin update, and a rotated/translated transform.

The regression fails on master with each identity-bound axis over-expanded by exactly one additional margin (for example, expected -1.25 but got -1.5).

Validation

  • Release single precision: built BulletCollision and Test_Collision; all 6 collision tests pass.
  • Release double precision (USE_DOUBLE_PRECISION=ON): built BulletCollision and Test_Collision; all 6 collision tests pass.
  • C++98 (-std=c++98): built and ran Test_Collision; all 6 collision tests pass.
  • git diff --check

Keep cached polyhedral bounds margin-free so both virtual and nonvirtual AABB paths apply the current collision margin exactly once. Add a convex hull regression covering transformed bounds and runtime margin updates.
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.

btPolyhedralConvexAabbCachingShape::getAabb() margin added twice

1 participant