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

General stability improvements #625

Merged
merged 25 commits into from
Apr 30, 2024
Merged

General stability improvements #625

merged 25 commits into from
Apr 30, 2024

Conversation

sebcrozet
Copy link
Member

@sebcrozet sebcrozet commented Apr 28, 2024

This PR implements several automatic stability fixes (that you will get automatically just by updating the rapier version), as well as some optional ones. Here is a short summary:

  • Implement a 2D block-solver as well as warmstarting. Significantly improves stacking capabilities. Generally reduces the "pop" effect that can happen due to penetration corrections.
  • Fix an issue where contacts would be completely ignored between two convex shapes.
  • Implement soft-ccd: a form of CCD based on predictive contacts. This is helpful for objects moving moderately fast. This form of CCD is generally cheaper than the normal (time-dropping) CCD implemented so far. It is possible to combine both soft-ccd and time-dropping ccd.
  • Add a contact_skin property to colliders. This forces the solver te maintain a gap between colliders with non-zero contact skin, as if they had a slight margin around them. This helps performance and stability for thin objects (like triangle meshes).
  • Internal edges were reworked to avoid dropping contacts that would help with stability, and improve stability of collisions between two triangle meshes.
  • Add IntegrationParameters::length_units to automatically adjust internal thresholds when the user relies on custom length units (e.g. pixels in 2D).

This PR also adds a rust port of several test cases from the Solver2d playground. See the 2D examples files with a name starting with s2d.

(Some of the videos below are low-resolution to stick with github’s 10MB video limit.)

Stacking improvements

General stacking improvements will be obtained automatically by updating to the newest version of rapier.

Stacking.-.lowres.mp4

Popping effect

The following video shows improvements in handling the "pop" effect due to penetrations. Here, objects were initialized in a penetration state.

Popping.effect.-.lowres.mp4

Dynamic triangle meshes

The following video shows improvements on handling triangle meshes attached to dynamic rigid-bodies. There is still some research needed before making them completely stable, but this is a step in the right direction.

All the meshes here were initialized with the TriMeshFlags::FIX_INTERNAL_EDGES flag, and are given a contact_skin equal to 0.1.

Dynamic.triangle.meshes.-.lowres.mp4

Contact skin

The following shows the difference between collisions with and without contact skin.
The colliders on the left part of the video were initialized without any contact skin. Colliders on the right were initialized with .contact_skin(0.2). Notice the gaps remaining between colliders on the right.

Contact.skin.-.lowres.mp4

Soft CCD

The following shows the effect of soft-CCD. The moving think object is initialized with a velocity of -100.0 along the vertical axis.
Left: no soft-CCD, Right: soft-CCD enabled with a max prediction distance of 10.0.

Soft-ccd.mp4

@sebcrozet sebcrozet merged commit a36f161 into master Apr 30, 2024
5 checks passed
@sebcrozet sebcrozet deleted the stability-improvements branch April 30, 2024 21:10
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