This project is read-only.

Circle Shapes colliding into the ground then pushing up

Jun 19, 2010 at 11:32 AM
Edited Jun 19, 2010 at 11:33 AM

Hey guys,

I'm having a weird problem. I have a circle which is being pulled down by gravity and when you press control an impulse is applied to make it jump. Then I have a platform underneath it.

However, when the circle lands, it sinks into the ground a bit:

http://dl.dropbox.com/u/939828/collision%20problem.PNG

And then in the next frame, it pops out and sits perfectly above the platform.

Is this problem common?

 

 

 

Jun 19, 2010 at 7:05 PM

It is a pretty common problem for an iterative solver and for Box2D in general.

You can try making your circle a bullet (isBullet = true when defining the body).

You can also try increasing the velocity/position iterations for the solver.

You might also want to make the floor thicker if it is already very thin, but it sounds like it is correcting itself and not going through the ground so that may not help you much.

Also, what scale factor are you using?  Is 1 pixel 1 meter and therefore you are dealing with physically massive objects?

Jun 20, 2010 at 3:24 AM
Edited Jun 20, 2010 at 3:26 AM

The circles got a radius of 1, so its realistic units. But yeah, I noticed in the Box2d.XNA samples that the circle shape seems to suffer this problem while the polygon shape doesn't, which is weird. I ended up changing to Farseer 3 because I heard, even tho its not completely finished, that most of the code is taken directly from Box2d.XNA, but apparently parts of it have been updated so Farseer 3 is actually a more up to date version of Box2d than Box2d.XNA currently is. Perhaps Farseer 3 just set the initial parameters of Box2d a lot better than I did, but the circle shape never seems to dig into the ground even when I fall at incredible speeds.

Reference: http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=215789