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

Ensure convex polygon does not panic due to invalid amount of points #168

Merged
merged 3 commits into from
May 2, 2024

Conversation

hakolao
Copy link
Contributor

@hakolao hakolao commented Oct 13, 2023

I'm constantly running into panics, due to

parry2d-0.13.5\src\shape\convex_polygon.rs:185:59:
index out of bounds: the len is 2 but the index is 2

This occurs more often than normally (I assume), because I create compound shapes at runtime after deforming objects into smaller ones.

It should not be possible to create a polygon that has less than 3 points. Also, it should be ensured that no empty points is passed. That fixes another crash where normals[0] indexes points that don't exist.

@hakolao
Copy link
Contributor Author

hakolao commented Dec 11, 2023

Related #65 and #50

@caspark
Copy link

caspark commented Feb 1, 2024

Calling Rapier's ColliderBuilder::convex_decomposition_with_params(&vertices, &indices, &VHACDParameters { resolution: x, ..}) with 3-4 vertices all approximately x distance from each other seems to be a pretty reliable way to trigger the underlying issue here in Parry.

@sebcrozet sebcrozet merged commit 1d530f8 into dimforge:master May 2, 2024
5 checks passed
@sebcrozet
Copy link
Member

Thank you!

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