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

Add friction and restitution on penetration constraint solving #1277

Merged
merged 4 commits into from
Jul 22, 2024

Conversation

fallenatlas
Copy link
Contributor

@fallenatlas fallenatlas commented Jul 3, 2024

Description

  • Adds friction impulse calculation, for now friction is the same for all particles.
  • Adds restitutions to be able to customize the amount of energy lost/conserved on collision, changing the perceived bounciness of objects. For now the restitution coefficient is the same for all particles.

Note: I couldn't find how to apply restitution using accumulated impulses anywhere, which is ridiculous, so the implementation I have is based only on how Erin Catto does it in Box2D v3.0, which he says it's not the most accurate but it seems to work pretty well.

Checklist

  • Self-review changes.
  • Evaluate impact on the documentation.
  • Add entry to the changelog's unreleased section.

@fallenatlas fallenatlas self-assigned this Jul 3, 2024
@fallenatlas fallenatlas linked an issue Jul 3, 2024 that may be closed by this pull request
Copy link
Contributor

github-actions bot commented Jul 3, 2024

PR Preview Action v1.4.7
🚀 Deployed preview to https://GameDevTecnico.github.io/cubos/preview/pr-1277/
on branch gh-pages at 2024-07-22 23:05 UTC

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 94 lines in your changes missing coverage. Please review.

Project coverage is 36.19%. Comparing base (071ab63) to head (9fb7ea3).

Files Patch % Lines
...c/physics/solver/penetration_constraint/plugin.cpp 0.00% 87 Missing ⚠️
...src/physics/constraints/penetration_constraint.cpp 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1277      +/-   ##
==========================================
- Coverage   36.27%   36.19%   -0.08%     
==========================================
  Files         376      376              
  Lines       30851    30916      +65     
==========================================
  Hits        11191    11191              
- Misses      19660    19725      +65     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fallenatlas fallenatlas linked an issue Jul 3, 2024 that may be closed by this pull request
@fallenatlas fallenatlas force-pushed the 1244-add-friction-on-constraint-solving branch from bf5b56a to f0628f9 Compare July 3, 2024 14:06
@fallenatlas fallenatlas marked this pull request as ready for review July 3, 2024 14:51
@fallenatlas fallenatlas requested review from a team and RiscadoA as code owners July 3, 2024 14:51
Copy link
Member

@RiscadoA RiscadoA left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Thanks for working on this! I don't really understand the math, but codewise the only thing I have to point out is the magic number stuff

@RiscadoA RiscadoA requested review from luishfonseca and removed request for roby2014 July 4, 2024 06:56
@luishfonseca
Copy link
Contributor

@fallenatlas please share your resources for the physics engine to ease reviewing. The math looks right, but i don't know if I'd catch errors without a reference

Copy link
Contributor

@DiogoMendonc-a DiogoMendonc-a left a comment

Choose a reason for hiding this comment

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

Very hard to review these extremely niche PRs, but lgtm

@fallenatlas fallenatlas force-pushed the 1244-add-friction-on-constraint-solving branch from 49215f6 to 62eeb7b Compare July 7, 2024 12:28
@fallenatlas fallenatlas force-pushed the 1244-add-friction-on-constraint-solving branch from 62eeb7b to 9fb7ea3 Compare July 22, 2024 23:04
@fallenatlas fallenatlas merged commit 3dacdc8 into main Jul 22, 2024
11 checks passed
@fallenatlas fallenatlas deleted the 1244-add-friction-on-constraint-solving branch July 22, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement restitution Add friction on constraint solving
4 participants