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.
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.
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.
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.
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:
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.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).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.
https://github.com/dimforge/rapier/assets/1734958/945073d9-1a94-4908-abc2-779a8db7127e
Popping effect
The following video shows improvements in handling the "pop" effect due to penetrations. Here, objects were initialized in a penetration state.
https://github.com/dimforge/rapier/assets/1734958/9161862e-3be1-4c73-af68-84a15e744460
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 acontact_skin
equal to 0.1.https://github.com/dimforge/rapier/assets/1734958/e3ab3db7-c77c-43b8-b660-63602ab7448d
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.https://github.com/dimforge/rapier/assets/1734958/7d4fdbdc-953a-4a09-aac6-fd574efec046
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.https://github.com/dimforge/rapier/assets/1734958/8a23bb6a-0492-4f5a-92f5-b68fd9928f44