Page 4 of 4

Posted: Sat Feb 17, 2007 2:05 pm
by LonelyStar
Ok, that makes sense.

I have another question:

The accumulated normal impulse is clamped, not the normal impulse calculated in every iteration, correct?

I wondering about the following scenario:
A Box (A) is colliding head on with another Box (B) in free space.
Both boxes have a elasticity of 1.0:

A-> <-B

Collision is detected -> an Arbiter is created.
In The first iterarion, impulse is calculated and applied, the scene should now look like this:

<-A B->

(Which is already the correct outcome).
But now the second iteration comes.
The calculated impulse is negative! But since the accumulated impulse at this point should be zero, the impulse is not clamped.

The result is obvious wrong!

Thanks for clearing things up!
Nathan

Posted: Sat Feb 17, 2007 2:42 pm
by stbuzer
The accumulated impulse is clamped to result in positive value, since collisions are inequality constraints. The original code from Box2D demo handles only cases with restitution=0.

Posted: Wed Feb 21, 2007 4:47 am
by BioSlayer
Hi I?ve recently rewrote my physics engine called Physics 2D the newer version is called Physics2D.Net and it is completely written in C#.
The reason I?m posting about this in this thread is that it uses the Algorithms from Box2D. You can download a 2 day old version on SF.Net.


And I had a problem with making a large pyramid like the one in the demo, with the version that splits the impulses The problem was that if I added too many block the pyramid the blocks on the bottom and middle would start shaking very rapidly and the whole thing would start sliding and shifting. I realized this problem was do to the high bias factor but didn?t want to lower it for non-stacking objects. So this is how I solved the problem: during collision detection I have each Body count how many other bodies it is colliding with. Then during the prestep part I calculate a biasMultiplier:

float biasMultiplier = 1/Pow(Min(b1.CollisionCount, b2.CollisionCount),2);

And multiply it against bias for each contact in the arbiter.

This works rather well. The pyramid is a lot more stable.

Posted: Wed Feb 21, 2007 5:03 am
by raigan2
was this using Baumgarte or split-impulses for penetration correction?

Posted: Wed Feb 21, 2007 7:01 am
by BioSlayer
This is using Erin Cattos algorithm which I thought was called sequential impulses not split impulses.

Posted: Wed Feb 21, 2007 3:03 pm
by bone
BioSlayer wrote:This is using Erin Cattos algorithm which I thought was called sequential impulses not split impulses.
To be honest, I've been getting confused between the definitions of these, too.

Posted: Wed Feb 21, 2007 3:07 pm
by raigan2
sequential impulses are used to iteratively build the solution, but in a recent update he added "split-impulses", which separates position and velocity correction.

Posted: Wed Feb 21, 2007 4:41 pm
by BioSlayer
Well the code that?s on sourceforge uses the original version of sequential impulses. But I also have been working implementing his newer version (split impulses) and that is what this fix is for. Right now I have the split and non split versions of the Erin Catto?s solver algorithm. My engine supports more then one solver.

Posted: Sun Feb 25, 2007 4:09 am
by BioSlayer
I have released a new version with split impulses.
and my project has moved to google code.

http://physics2d.googlepages.com/