Skip to content

Split bouncy and resting contacts (take 2) - #114

Merged
sebcrozet merged 3 commits into
dimforge:masterfrom
EmbarkStudios:split-contacts-2
Feb 18, 2021
Merged

Split bouncy and resting contacts (take 2)#114
sebcrozet merged 3 commits into
dimforge:masterfrom
EmbarkStudios:split-contacts-2

Conversation

@emilk

@emilk emilk commented Feb 15, 2021

Copy link
Copy Markdown
Contributor

If a contact is new (previous impulse = 0), then we treat it as bouncy (respecting restitution). If the contact is old we treat it as resting.

This allows us to remove the restitution_velocity_threshold parameter.

Special cases:

  • restitution <= 0 is always treated as resting
  • restitution >= 1 is always treated as bouncing

Test

A 0.9 restitution ball bouncing on ground with the same (very high) restitution.

Before

Previously an arbitrary restitution_velocity_threshold cutoff led to an abrupt end to bounces:

previous

Screen Shot 2021-02-15 at 21 22 01

After

Bounces keep going up to nyquist limit, into a smooth transition to rest:

Kapture 2021-02-15 at 21 28 11

Screen Shot 2021-02-15 at 21 28 50

@emilk emilk changed the title Split boncy and resting contacts Split bouncy and resting contacts (take 2) Feb 17, 2021

@sebcrozet sebcrozet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR!

Comment thread src/dynamics/solver/velocity_constraint.rs Outdated
Comment thread src/dynamics/solver/velocity_ground_constraint.rs Outdated
Comment thread src/dynamics/solver/velocity_constraint_wide.rs Outdated
Comment thread src/dynamics/solver/velocity_ground_constraint_wide.rs Outdated
If a contact is new (previous impluse = 0), then we treat it as bouncy (respecting restitution).
If the contact is old we treat it as resting.

Exceptions for restitutions <=0 and >= 1.
@emilk
emilk requested a review from sebcrozet February 18, 2021 17:19
@sebcrozet
sebcrozet merged commit c650bb1 into dimforge:master Feb 18, 2021
@sebcrozet

Copy link
Copy Markdown
Member

Thanks!

@emilk

emilk commented Feb 18, 2021

Copy link
Copy Markdown
Contributor Author

🥳

jamespohalloran pushed a commit to jamespohalloran/rapier that referenced this pull request Apr 26, 2025
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.

2 participants