Repository navigation
Fix rolling balls sinking into the ground - #1071
Open
paulrobello wants to merge 1 commit into
Open
paulrobello wants to merge 1 commit into
paulrobello wants to merge 1 commit into
Conversation
Contacts are found once per step and each substep re-measures the separation from a body-fixed anchor. For a ball the true contact point stays at centre + r*n while the ball spins, but the body-fixed anchor rotates away and lifts by r*(1 - cos(theta)), which the solver read as separation, so rolling balls sank until the bias cancelled it. ContactManifoldData::centered_ball marks a side whose collider is a ball centred on its body's CoM. For such a side the twist and Coulomb kernels track the normal separation from the body centre. Friction keeps the body-fixed anchor. Other shapes and the generic constraint path are unchanged. Goldens re-minted for the changed contact behaviour: - parallel_path_parity 0xcc9e_c93f_2c15_65cc -> 0x0332_9d78_889b_bd8c - simd_backend_determinism 0xe488_2a11_2d57_d212 -> 0x9943_2aa0_b8ca_3abe - 3D snapshot_portability (488_334, 0x3f5e_ac53_ad07_5243) -> (490_354, 0x504c_043a_1997_c125) - 2D snapshot_portability (90_574, 0x3019_f8f0_67c5_e643) -> (90_960, 0x85b4_446d_161e_81d5) The snapshot sizes grow because centered_ball is serialized (serde default), so a restored world keeps it for recycled steps.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1070.
Contacts are found once per step, and each substep re-measures the separation from a body-fixed anchor. For a ball, the true contact point stays at
centre + r·nwhile the ball spins. The body-fixed anchor rotates away and lifts byr·(1 − cos θ). The solver reads that lift as separation, so rolling balls sink until the bias cancels it.Change
ContactManifoldData::centered_ball: [bool; 2](crate-private,serde(default)). It is set inpair_update.rswhen a side's collider is a ball centred on its body's CoM.updateandupdate_rhs_wo_bias.Results
Measured on a 16 mm ball at 240 Hz on a flat trimesh. A frictionless sliding ball sits at the soft-contact equilibrium, 0.069 mm, both before and after.
Tests
New test:
pipeline::physics_pipeline::test::rolling_ball_does_not_sink_into_the_ground. It covers both friction models and both collider orders. On v0.36.1 it fails for the Simplified model with the ball first: rolling penetration is 0.00245 against 0.00160 sliding.Goldens re-minted, because contact behaviour changes for every rolling ball:
parallel_path_parity0xcc9e_c93f_2c15_65cc0x0332_9d78_889b_bd8csimd_backend_determinism0xe488_2a11_2d57_d2120x9943_2aa0_b8ca_3abesnapshot_portability(488_334, 0x3f5e_ac53_ad07_5243)(490_354, 0x504c_043a_1997_c125)snapshot_portability(90_574, 0x3019_f8f0_67c5_e643)(90_960, 0x85b4_446d_161e_81d5)The snapshot sizes grow because
centered_ballis serialized, so a restored world keeps the flag for recycled steps.run-ci-checks.shpasses locally.CHANGELOG.mdhas an Unreleased/Fixed entry.