Skip to content

Fix ball penetrating arena under sustained force#66

Open
Z-OMG wants to merge 1 commit into
ZealanL:v3-rustfrom
Z-OMG:patch-1
Open

Fix ball penetrating arena under sustained force#66
Z-OMG wants to merge 1 commit into
ZealanL:v3-rustfrom
Z-OMG:patch-1

Conversation

@Z-OMG

@Z-OMG Z-OMG commented Jul 7, 2026

Copy link
Copy Markdown

No description provided.

@ZealanL

ZealanL commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Interesting... how does this change affect collision accuracy? Is there a reproducible case for this? How easily can this bug occur? Many questions...

@Z-OMG

Z-OMG commented Jul 7, 2026

Copy link
Copy Markdown
Author

RocketSim V3 has issues with the ball penetration, it is a fact and its tested.
V3's contact solver did

if cp.is_special { …; continue; }

for ball-vs-world contacts, skipping the per point constraint that carries the penetration depth.
So the ball gets zero positional recovery and sinks into the floor/wall under sustained force.
It is tested in the latest version of RocketSim V3.
I tested it by putting a sustained force on the ball towards the ground, then it sank underground.

@Z-OMG

Z-OMG commented Jul 7, 2026

Copy link
Copy Markdown
Author

And what I did to fix it:

  1. Accumulate the real penetration alongside the existing sums: total_penetration += cp.distance_1

  2. In convert_contact_special, feed the averaged real penetration (total_penetration/num) into the split-impulse positional term of that single averaged constraint.

@VirxEC

VirxEC commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Are we sure let distance = sri.total_dist / num_collisions; shouldn't just be replaced with avg_penetration

@Z-OMG

Z-OMG commented Jul 8, 2026

Copy link
Copy Markdown
Author

No, distance has to stay total_dist / num_collisions. It's used for two unrelated things, and only one of them is the penetration:

  1. rel_pos1 = normal_world_on_b * -distance

  2. let penetration = distance;

distance = radius (contact geometry), avg_penetration = real depth (positional recovery). They're not interchangeable, so merging them regresses the contact solve.

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.

3 participants