Box2d - Possible to get rid of accumulated impulses?

Please don't post Bullet support questions here, use the above forums instead.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

I made some tests and it appeared that for joints it might not be the case that the last solution is a good guess for the next step. Maybe a good try would be to remove the warmstarting from Erin "Suspension Bridge" example. Actually it would be better to test it also for ragdolls and chains.
coderchris
Posts: 49
Joined: Fri Aug 18, 2006 11:50 pm

Post by coderchris »

Not a stupid question at all...me wanting to not warmstart is stupid

Im just curious to know if it is even possible to have a stable simulation without warmstarting, not for any particular reason
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

Im just curious to know if it is even possible to have a stable simulation without warmstarting, not for any particular reason
This is more a philosophical question. Erwin gave a very good answer to this before in my opinion. The major question is if stable stacking is necessary for your game. From my experience I would say that you basically build sleeping stacks in your game and you want them to collabs when they are hit. Nobody seems to use the magic shock wave since it make everything even more stable. Also note that the warmstarting doesn't come for free. The same is true for the split impulse. You need to decide this on the requirements of your game. Behaviour physics might even give much higher requirments to your solver and you need even different strategies.

Cheers,
-Dirk
Moz
Posts: 1
Joined: Mon Nov 06, 2006 5:46 pm

Post by Moz »

coderchris wrote:I read something somewhere about "shock propagation" Supposedly that lets you have fairly stable stacking. I was unable to find any articles describing how to do it, would you happen to have any links?
http://graphics.stanford.edu/papers/rigid_bodies-sig03/
coderchris
Posts: 49
Joined: Fri Aug 18, 2006 11:50 pm

Post by coderchris »

To clarify, I need stable stacking, at least 7 - 10 boxes without warmstarting and without keeping any other contact related information from step to step. Basically I need to regenerate the contact impulses every time using a 1/60 timestep and 10 - 20 itterations.

That paper looks interesting, ill look into it more
Chris Elion
Posts: 10
Joined: Tue Nov 07, 2006 5:16 am
Location: Dublin, Ireland / San Francisco, CA

Post by Chris Elion »

Dirk Gregorius wrote:Also note that the warmstarting doesn't come for free.
Just curious what you mean by this. Aside from additional memory requirements, what are the drawbacks? I suppose some algorithms (power iterations for eigenvectors, maybe CG) would fail if the starting guess was orthogonal to an eigenvector of interest, but that seems pretty unlikely in practice.

Assuming the problem you're solving has a unique solution, warmstarting should give you a pretty good initial guess. But if you're willing to do more iterations, you should reach the same answer with or without warmstarting (eventually).
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

You must create the contact identifiers and match them each frame. For joints the overhead might be negligible.

I agree with what you say. Anyway I had some problems with warmstarting when a joint chain is attached to a kinematic actor. I would argue that everything that is about to come to rest will benefit from warmstarting. For an animated system I need to further investigate this. A test would be a chain simply hanging down compared to the same chain where the root is slightly moved on a circle.
coderchris
Posts: 49
Joined: Fri Aug 18, 2006 11:50 pm

Post by coderchris »

yay I got it working :D

turns out shock propagation worked very well indeed, no warmstarting needed and you can get by with very low iterations. I tweeked it a bit so that the stacks will still topple over reasonably by making the lower ones feel half of the weight of the upper boxes instead of none of the weight, and I also used half the total number of iterations for the shock propagation instead of just the last one. Actually, seems even more stable than before, and quite a bit faster since theres a bunch of math operations that no longer need to be done, plus i dont need to keep track of which contacts are which