Skip to content

overlap_shape copies the proxy's points before testing - #105

Merged
nicolas-maman merged 1 commit into
mainfrom
fix/overlap-proxy-alias
Oct 4, 2026
Merged

nicolas-maman merged 1 commit into
mainfrom
fix/overlap-proxy-alias

Conversation

@nicolas-maman

Copy link
Copy Markdown
Collaborator

I audited the shape queries against Box3D e77352c: sphere and capsule geometry, the shape-level dispatch, and the compound queries. All of it matches upstream except this one defect.

The bug: a proxy built by make_shape_proxy for a sphere or capsule points into the sphere module's per-worker scratch. overlap_sphere and overlap_capsule build their own shape's proxy in that same scratch before GJK reads the given one, so the shape was tested against a copy of itself. A ball 10 m away reported as overlapping. This affects shape.overlap_shape and, through it, the world and body overlap queries, for every shape visited after the first sphere or capsule. Upstream's proxies point straight into the shapes and share nothing.

The fix: overlap_shape copies the given proxy into its own buffer first, as shape_cast_shape already did.

test_shape's new test_overlap_own_proxy makes a proxy from a ball at the origin and tests it against a ball and a capsule 10 m away. Both are reported apart now; on main both report overlapping.

All 28 test programs pass locally on aether 0.772.0, with no warnings.

A proxy made by make_shape_proxy for a sphere or capsule points into the
sphere module's per-worker scratch, and overlap_sphere / overlap_capsule
build their own shape's proxy in that same scratch before GJK reads the
given one: the shape was tested against a copy of itself, so a ball far
away overlapped (shape.overlap_shape, and through it the world and body
overlap queries, for every shape after the first sphere or capsule).
The reference's proxies point into the shapes and share nothing. Now
overlap_shape copies the given proxy into its own buffer first, as
shape_cast_shape already did.

test_shape's test_overlap_own_proxy: a proxy made from a ball at the
origin against a ball and a capsule 10 m away -- apart (main: touching).
Found by an audit of the shape queries against Box3D e77352c, otherwise
faithful.
@nicolas-maman
nicolas-maman merged commit 6d439cd into main Oct 4, 2026
1 check passed
@nicolas-maman
nicolas-maman deleted the fix/overlap-proxy-alias branch October 6, 2026 23:09
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