Friction Impulses (boxes are sliding on the ground)

Started by
10 comments, last by Irlan Robson 9 years, 2 months ago

Hi.

The problem I'm facing with is with correct impulses but wrong behaviour. The physics engine uses split-impulses (bias-velocities), but when objects fall over a plane it starts to slide like if there was an joint above them. Here's a video:

[This video was deleted because was messing up with my channel, but it is what the description says]

The loop (at 60HZ = 0.016ms):

Update contact positions (contact caching not implemented yet, so skip it);

Check for collisions;

Apply forces (integrate velocities);

Prepare constraint data (normal inverse mass, two tangents inverse mass, and bias values);

Warm Start last frame impulses (contact caching not implemented yet, so skip it)

Apply Contact Constraint Impulses (10 iterations, zero accumulated bias impulse, etc.);

Apply velocities (integrate positions, zero bias velocities);

I'm skiping the warm start, but that doesn't mean that I should get the behaviour above.

Has anyone faced with that problem?

Here's the overview of each task:

http://pastebin.com/K1iF06nH

Advertisement

Are the blinking points your contacts? It appears that you have only one contact point per frame which would be indeed unstable. Also note that the friction quality depends strongly on the warmstarting. I recommend that you improve your collision detection and build proper manifolds. Then add warmstarting. In the current state you cannot expect any reasonable quality.

Are the blinking points your contacts? It appears that you have only one contact point per frame which would be indeed unstable. Also note that the friction quality depends strongly on the warmstarting. I recommend that you improve your collision detection and build proper manifolds. Then add warmstarting. In the current state you cannot expect any reasonable quality.

Yeah. I have GJK-EPA working but no contact caching implemented yet maybe that's the problem. I was using btContactManifold but no sucess.

I've seen many people using simple contact caching working very well, and I've read that SAT it is the recommended, but do you know if contact caching plus some optimizations would able me to get stable results? At least a stack of 10 boxes?

Thanks.

If you can build a stable manifold (and by this I mean you can track contact points over multiple frames, and have more than one contact point for a collision) then yes, you can easily stack 10 boxes with a fair number of iterations per frame. If you tack on warm starting to this you can easily stack more than 10 boxes with fewer iterations per frame.

If you can build a stable manifold (and by this I mean you can track contact points over multiple frames, and have more than one contact point for a collision) then yes, you can easily stack 10 boxes with a fair number of iterations per frame. If you tack on warm starting to this you can easily stack more than 10 boxes with fewer iterations per frame.

The problem is that if my angular velocity impulses are wrong, it means that I can't build a full manifold. I've debugged and from what I see is that when disabling the bias impulses and the tangent impulses, everything looks correct.

When enabling or friction or bias the objects penetrates on each other sometimes and the edge of the cube that is planning on the plane keeps sliding without settle on the ground like if there was an joint above it (see the moving red cube on the video).

The EPA and GJK is working more than it should, and I've debugged all the normals, tangents, local and global contact points, but since something is wrong. There video shows both global contact points, that's why the blinking is more perceptive.

I'm 80% sure that is something wrong with the angular velocities, but I've checked my inertia tensors, quaterntions, etc. and nothing wrong noticed.

I'm trying build a full manifold each frame. I did based on this explanation.

If anyone has a suggestion here is the code:

http://pastebin.com/bDvis5YR


If you can build a stable manifold (and by this I mean you can track contact points over multiple frames, and have more than one contact point for a collision) then yes, you can easily stack 10 boxes with a fair number of iterations per frame. If you tack on warm starting to this you can easily stack more than 10 boxes with fewer iterations per frame.

Hey, thanks indirectly! Just compared my quaternion class with yours when checking your q3be demo source code. The quaternion convertion was right but my multiplication was wrong (which means I should shot myself on the foot). Everything is working as it should now be without a full manifold and it is quite stable. Here's a video if someone is interested:

Thanks.

Well since you already found qu3e if you wanted to implement warm starting that might be a good place to learn how to use SAT. Though it only works for boxes currently!

Well since you already found qu3e if you wanted to implement warm starting that might be a good place to learn how to use SAT. Though it only works for boxes currently!


Oh, I'd need more time to look at it, but I don't have because is my thesis and I have most of the explanation in my mind to write about GJK and EPA, but thanks for the advice. I'll keep with contact caching and some optimizations.

I've downloaded q3ue and it's well implemented, but looks like you're adding energy to the system using bias impulses directly. Would you have any specific reason for doing that? Looking at the demos looks pretty stable though.

Yeah, that's using the Baumgarte method, which I learned from reading Erin Catto's online resources. Erin writes down some methods for coming with an equation to add energy to a constraint to make sure "constraint drift" doesn't result in inaccurate simulation. You can also find information on the Bullet forums about the Baumgarte factor.

Yeah, that's using the Baumgarte method, which I learned from reading Erin Catto's online resources. Erin writes down some methods for coming with an equation to add energy to a constraint to make sure "constraint drift" doesn't result in inaccurate simulation. You can also find information on the Bullet forums about the Baumgarte factor.

Yeah. I tried this method at first too. On his 2009 (don't remember correctly) he said about using pseudo-velocities which could be done just having a single velocity for penetration correction cleared each position integration which avoid adding energy to the system during the resolution phase, and since I'm not using a intersection routine that gives me a full manifold at time I tought would be better search for a stable solver though still need to implement a cache to get warm starting working, but since you have SAT and clipping working that might not be a huge problem.

I already have all his papers since GDC 2005, but only now I was able to re-write a decent constraint solver and a more sofisticated discrete intersection routine. My thesis is a rigid body simulation, which at first was being based on Ian's book (which comes with direct methods of handling penetration), but after reading Erin's papers I felt like I need to explain his solvers approximations based on his valuable and well explained resources.

Thanks.

This topic is closed to new replies.

Advertisement