This project has moved and is read-only. For the latest updates, please go here.

Object interaction with ground

Jul 7, 2009 at 10:30 PM

I am making a physics sandbox using farseer.  I have only encountered two problems so far.  When I create polygons and dont subdivide the edges, it gets very poor collision detection.  Along corners (one polygon corner colliding with another polygon corner isnt detected for some reason).  When I do subdivide the edges, it looks like it still misses the corner to corner collision but hits one of the subdivided vertices a little bit in.  I can live with this :).  My problem right now is that when I create a polygon and drop it on the ground horizontally, it keeps jumping and doesnt stabilize.  Combined, the ground and polygon have a restitution co-efficient of 0.3f, so i dont think thats the problem.  Heres an idea of the ground and polygon orientation


Polygon: /_____________\

Ground: _______________

Any suggestions are appreciated.

Jul 7, 2009 at 11:38 PM

For the collision detection, you can try with a lower grid cell size. It is also described in the manual.

Are you by any chance using the polygon brush from the samples?

Jul 8, 2009 at 1:57 AM

Yes, im using the polygon brush.  How would I go about making a decent "ground" / plane that reacts well with objects.  Right now, my polygons with long sides are VERY unstable on the rectangle I created.

Jul 8, 2009 at 2:24 AM

When I increase vertices (SubDivideEdges), it makes so polygons dont enter each other, but it makes the polygons very unstable on the ground.

When I decrease the vertices, it makes the polygons stable on the ground but polygons go into each other.

I suppose Ill look into the grid cell size.

Do you think if I use few vertices and smaller grid cell size, it will take care of my problem?

Jul 8, 2009 at 2:28 AM

I've had some problems with the polygon brush jittering. Try adding the debug view (PhysicsSimulatorView) from the samples and enable it in your game. The outline of the polygon should be stable.

Jul 8, 2009 at 2:44 AM

I took care of the polygonbrush jittering.  By unstable I mean sides are bouncing up and down visibly.

I just changed the default gridsize value.  unfortunately, this changed the objects position, etc.

If you know what I should change to compensate changing _gridCellSizeAABBFactor in DistanceGrid that would be great.

Jul 8, 2009 at 2:49 AM

If it is not the polygon brush, then I don't know what it is. You should never get a jittering behavior from the collision system. The grid cell size only determine the precision of the collision data on your shape.

If you are able to send me a sample that demonstrates this problem or your project it would be great. I'll contact you with my email so that you are able to send it to me.

Jul 8, 2009 at 2:57 AM

Oops, that position change was my fault.  Changing the _gridCellSizeAABBFactor didnt do anything.

How can I make it so the ground doesnt make objects with lots of vertices colliding with it go crazy?

Jul 8, 2009 at 3:03 AM

Alright, my email is

Do you have an xbox360 controller for pc?

Ill send you the project.