Unstable collision/stacking.

Topics: Developer Forum, User Forum
Dec 18, 2007 at 3:54 PM
I've been testing Farseer for a while and I must say that I really like the structure and ease of use.
However, I've been running into a few problems when it comes to resting bodies.

There seem to be a constant jitter for each body, and sometimes the forces suddenly jump a bit and causes unnatural movement.

And last night a stumbled upon a even more disturbing problem. If I have two boxes (in this case circles with four sides) colliding horizontally, and really slow. They begin to intersect, and finally one body "eats" the other one.

The example in this ZIP should display the behavior described (let it run for ~30 seconds and the red and blue box will end up inside each other):
Dec 18, 2007 at 6:39 PM
Farseer Physics does not support resting bodies. I don't know if crashlander (the maker of Farseer) has planed support for this.

As for the intersection of bodies, please look at this:


I don't know if i'm having the same problem, or this is caused by the way I handle the physics engine, I wish crashlander would take a look at it, it's a huge problem.

Anyway, I can't see the problem by the demo you provided. The red and blue box does not end up inside each other, as they are separated by the yellow bar.
Dec 18, 2007 at 9:57 PM
Hmm thats another problem then I guess, that the physics dont play out the same given the same time step.
I tried my example on two different machines, with the same result..

And I knew that resting bodies wasnt supported, but its still annoying that things never really settle and "random" jumps in forces occur.
Anyway, my main problem is that geometries end up inside each other after a while.

Made a video of my problem (XviD):
Dec 19, 2007 at 9:40 PM
I think the geometries end up inside eachother because you are using a circle to create a rectangle. This gives you only 4 vertices. Farseer needs more verts then that on the edges. If you look at the create rectangle code you will see there are 4 corner verts and I think 3 more verts on each edge.

Collions are checked by checking if a vert of one body is IN the other body. If you only have 4 corners on each and they line up perfectly with the edges of the other then they are not really IN the other body.

That is my guess.

As for the jittering, I think that is just a tuning issue. Decrease the PhysicsSimulator.BiasFactor and play witht the AllowedPenetration.

Hope this helps.

Dec 19, 2007 at 10:33 PM
So, about Farseer not supporting resting bodies: does this mean that it is just as performance intensive to have lots of bodies resting in contact as it is to have lots of bodies colliding simultaneously?
Dec 20, 2007 at 11:25 AM
Yes, currently Farseer does not put objects to "sleep" when they are at rest.

It'd be a nice feature but it just didn't make it in yet... Probably some future release.