How to edit friction of ongoing contact? #894
-
|
I am using box2d for a platformer game that mixes physics with crisp movement control. My current approach is copied from this article: In the article the author states:
I can confirm that just modifying the friction does not modify the friction for the ongoing collision with the floor. The player keeps sliding across the floor as it were ice. I then followed the authors advise on modifying the contact friction in the presolve callback but I seem to be doing it wrong. My preSolve callback is as follows. I am using zig here: Should I modify the tangentImpulse of manifold points p1 and p2 or should I be doing something else? Does this seem correct? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Okay it seems impossible to edit the ongoing contact friction in box2d v3. Is there a way to tell box2d to reset the ongoing contact? |
Beta Was this translation helpful? Give feedback.
-
|
You can set the friction on the shape and this will update the contact friction. You don't need to do this in the presolve. See |
Beta Was this translation helpful? Give feedback.
You can set the friction on the shape and this will update the contact friction. You don't need to do this in the presolve. See
b2FrictionCallbackon main.