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

Feature: Add support for custom friction and bounce CombineRules #622

Open
Ughuuu opened this issue Apr 19, 2024 · 2 comments · May be fixed by #741
Open

Feature: Add support for custom friction and bounce CombineRules #622

Ughuuu opened this issue Apr 19, 2024 · 2 comments · May be fixed by #741
Labels
2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics C-Enhancement New feature or request D-Medium P-Medium

Comments

@Ughuuu
Copy link
Contributor

Ughuuu commented Apr 19, 2024

I have a use case where in Godot they use friction and bounce like so:

real_t combine_bounce(GodotBody3D *A, GodotBody3D *B) {
    return CLAMP(A->get_bounce() + B->get_bounce(), 0, 1);
}

real_t combine_friction(GodotBody3D *A, GodotBody3D *B) {
    return ABS(MIN(A->get_friction(), B->get_friction()));
}

So bounce they sum them, and then either take 0 or 1(bounce can be negative on some objects)
Friction they take the min and then take abs(agian, friction can be negative, and in such a case that is the value you always take). Weird case, but am thinking how could I do this in rapier?
Maybe if I could override the combine function from CoefficientCombineRule, I could make it work.

@Vrixyz Vrixyz added C-Enhancement New feature or request 2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics P-Medium D-Medium labels May 31, 2024
@Ughuuu Ughuuu changed the title Add support for custom friction and bounce CombineRules Feature: Add support for custom friction and bounce CombineRules Jun 28, 2024
@Ughuuu
Copy link
Contributor Author

Ughuuu commented Jun 28, 2024

Any updates on this? I would be willing to implement it if there was some guidance as to what is wanted for this (eg. a callback, more enum types for different friction/bounce actions? etc)

@Ughuuu
Copy link
Contributor Author

Ughuuu commented Jul 21, 2024

Ended up implementing it in a fork of rapier, since it's probably not a feature that's much needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics C-Enhancement New feature or request D-Medium P-Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants