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

Friction in PhysicsMaterial is too low even at 1.0 (the max) #48298

Closed
DanielKinsman opened this issue Apr 29, 2021 · 3 comments · Fixed by #48434
Closed

Friction in PhysicsMaterial is too low even at 1.0 (the max) #48298

DanielKinsman opened this issue Apr 29, 2021 · 3 comments · Fixed by #48434

Comments

@DanielKinsman
Copy link
Contributor

Godot version:
3.3 stable

OS/device including version:
linux

Issue description:
At the maximum value for friction (1.0) things are still very slippy. It was clamped to 0-1 in #42202. Experimenting by forcing a value of > 1.0 by manually editing the tscn with friction = 100.0 provides the grippyness I am after. Is it possible that the docs are wrong and it is actually a percentage rather than normalised? Or am I just abusing undefined behaviour in the physics engine? Values >100 seem to behave the same as 100 but I haven't done extensive testing.

Steps to reproduce:
Run the minimal reproduction project. One of the objects has a friction of 1.0, the other has a friction of 50.0 (both set with roughness). The one with 50.0 friction behaves with much more grip.

Minimal reproduction project:

frictiontest.zip

@akien-mga
Copy link
Member

CC @rcorre @godotengine/physics

@madmiraal
Copy link
Contributor

madmiraal commented Apr 30, 2021

Despite what the documentation suggested, there is a case for both bounce and friction to be greater than 1; so I think
#42203 and it's cherry-pick, should be reverted.

Note: Although, as pointed out here, combined bounce is clamped by the physics server to be between 0 and 1, the same is not true for friction:

real_t combine_bounce(Body2DSW *A, Body2DSW *B) {
return CLAMP(A->get_bounce() + B->get_bounce(), 0, 1);
}
real_t combine_friction(Body2DSW *A, Body2DSW *B) {
return ABS(MIN(A->get_friction(), B->get_friction()));
}

@rcorre
Copy link
Contributor

rcorre commented May 1, 2021

I wonder if it is different between 2D and 3D? I tried putting cubes on sloped planes with friction values of 50, 1, and 0.1 (both the plane and the corresponding cube). 0.1 slides down the slope, 1 sticks to the slope, and 50 jitters erratically.
example.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants