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

ConcavePolygonShape2D noisey errors, clipping. #285

Open
lgrammer opened this issue Oct 18, 2024 · 5 comments
Open

ConcavePolygonShape2D noisey errors, clipping. #285

lgrammer opened this issue Oct 18, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@lgrammer
Copy link

Describe the bug

Noisey errors from ConcavePolygonShape2D and clipping during collider regeneration that doesn't occur with default physics engine. The errors occur when colliders are generated, whether that's when loading up, or regenerating the mesh/collider. The clipping occurs only during regeneration.

image

To Reproduce

Use some segments to build a concave collider. My data is from a marching squares algorithms triangles list, but whatever should work as long as you pair points correctly.

image

Then swamp out the default engine from Rapier, that's when the yelling starts. Everything works outside of clipping. Collisions stay the same. Debug lines stay the same.

Expected behavior

No errors, no clipping or changes when swapping physics engines. I'll refrain from adding more information unless requested for now. This could honestly just be a user error or something simple as I was just swapping over to your plugin to check out the cool fluid stuff.

I've done a solid bit of stuff (tinkering) with Bevy/Rapier and iirc Rapier uses vertices and indices for polylines so maybe there's something going on there

In the default engine during the collider regeneration I can move along in a straight line. It's impenetrable and you can't get through the collider anywhere.

image

When switching back to Rapier and holding down the mouse key to regenerate the chunks as I move along, I can clip through.

image

If this isn't some sort of user/setup error on my part and you want a minimal example zipped up let me know.

@lgrammer lgrammer added the bug Something isn't working label Oct 18, 2024
@Ughuuu
Copy link
Contributor

Ughuuu commented Oct 18, 2024

Forgot to make a new release, will create v0.8.8 and you can try with that. If it still happens put a reproducible project.

@Ughuuu
Copy link
Contributor

Ughuuu commented Oct 18, 2024

Check with 0.8.8

@lgrammer
Copy link
Author

Checked with 0.8.8 and while that did indeed solve the errors issue, it seems clipping is still there during collider regeneration. Tested with fast SIMD and regular. Will work on zipping something up tonight.

@lgrammer
Copy link
Author

rapier_clipping.zip

Couldn't zip it up with your addon included as it was just a bit to large, sorry about that.

The collider regeneration occurs right after triangulation in the refresh function in the VoxelGrid class. Any chunk undergoing regeneration can be clipped through while it's occurring only when using Rapier for physics. The marching square method used is a port of this Unity implementation and follows similar naming conventions. So the 'voxels' are just points that compose the cells used for marching squares. Walking through the points in the triangles is how I get the collider polylines currently.

@Ughuuu
Copy link
Contributor

Ughuuu commented Oct 18, 2024

Np, you normally zip without the addon.
Ok i am able to debug it locally. Will check why it clips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants