I'm curious as to what's going wrong. Is the problem that the position correction is having too strong an effect on the box, or that the solver is simply not getting the right solution in some way? I didn't think box2d's friction model was good enough to keep stacks aligned as you pushed the bottom one in the best of circumstances?
Getting friction to work properly
General DiscussionBorisTheBrave wrote:
I'm curious as to what's going wrong. Is the problem that the position correction is having too strong an effect on the box, or that the solver is simply not getting the right solution in some way? I didn't think box2d's friction model was good enough to keep stacks aligned as you pushed the bottom one in the best of circumstances?
Yes, it is probably the position correction. Position correction for contacts does not observe mass ratios.
Under small forces stacks can stay aligned just fine. What lead you to this impression?
So with a bit of hacking you could turn off/down position correction for just the blob (i.e. any island of which the blob is a member), and avoid this effect? As it's a soft body, I don't think the penetration would become too problematic.
No observations regarding the friction, just trying to further my understanding. As there's no position correction for static friction, I had thought that the errors would accumulate each frame.
No observations regarding the friction, just trying to further my understanding. As there's no position correction for static friction, I had thought that the errors would accumulate each frame.
Yes, disabling position correction on the circles would likely solve the problem.
Take a look at the varying friction example. If you disable sleep, the boxes do not creep. IMO Box2D handles static friction quite well.
Take a look at the varying friction example. If you disable sleep, the boxes do not creep. IMO Box2D handles static friction quite well.
I made a hard-test by disabling position correction at all in the solver for my project. This effectively removes the problem, and the blob cant push the heavy box at all.
I will try as suggested, modifying my source, lets say, having a flag in b2Body where it has to use position correction or not. Something like that when I figure out this stuff (I am not so expert of physics engine 😉 )
Thanks, I think my problem is not so dark but greyish, which is a great improvement to see the light in very short time. I will update when I find out a good solution.
I will try as suggested, modifying my source, lets say, having a flag in b2Body where it has to use position correction or not. Something like that when I figure out this stuff (I am not so expert of physics engine 😉 )
Thanks, I think my problem is not so dark but greyish, which is a great improvement to see the light in very short time. I will update when I find out a good solution.
Modifying as suggested improved and solved my problem. Now I implemented a flag in b2Body which tells if this body should have position correction. The call to "Solve" and "SolveTOI" have an additional boolean param to solve position correction of not. If a body is found in a list for the island, which has flag disabled, all position correction wont be done for the island.
There could be a minor improvement, to disable individual corrections when a body which shouldnt be "corrected" is one of them. But for now it works sweet. Thank you for your suggestions.
There could be a minor improvement, to disable individual corrections when a body which shouldnt be "corrected" is one of them. But for now it works sweet. Thank you for your suggestions.
Original thread: https://box2d.org/forum/viewtopic.php?t=4000