Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact reporting may panic in assert #718

Open
Ughuuu opened this issue Aug 15, 2024 · 2 comments
Open

Contact reporting may panic in assert #718

Ughuuu opened this issue Aug 15, 2024 · 2 comments

Comments

@Ughuuu
Copy link

Ughuuu commented Aug 15, 2024

In specific case where the contact is reported with same ID, there will be a panic that occurs:

Here you have an example that reproduces this: appsinacup/godot-rapier-physics#195

Issue happens here:

src/geometry/broad_phase_multi_sap/sap_utils.rs

pub(crate) fn sort2(a: u32, b: u32) -> (u32, u32) {
    assert_ne!(a, b);

    if a < b {
        (a, b)
    } else {
        (b, a)
    }
}

In my case a is 7 and b is 7.

This function is called from:

src/geometry/broad_phase_multi_sap/sap_axis.rs

Possibly best is to change calling function of this (eg. batch_insert or update_endpoints) to not insert or sort if the proxies are equal. If we do allow equal proxies, that will introduce issues down the line (there are other asserts that will fail).

There is already such an if in one of the 3 places where this function is used, eg.:

In batch_insert:

if endpoint2.proxy() == endpoint.proxy() {
    continue;
}
@Ughuuu
Copy link
Author

Ughuuu commented Aug 15, 2024

Hm, no, if I do this if then some contacts are missed. Hm..

@Ughuuu
Copy link
Author

Ughuuu commented Aug 15, 2024

Strange issue, seems to be related to me scaling a shape, which results in a box with negative width I think.

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

No branches or pull requests

1 participant