FP3: How to subdivide vertices

Jun 2, 2010 at 11:03 PM

Hi, I'm new here, but I've started working on a game for the new Windows Phone.

I'm using FP3 built for Silverlight and everything's going great with it so far. But I did run across something odd which I was hoping to get help with.

I've noticed that very wide rectangle bodies (20+meters) behave weirdly when stacked on top of each other. I tried fiddling with the density with no luck. After stacking about 10 or so of these on top of each other, they start to interpenetrate (as if they're collapsing under their own weight).

The code I have is simply to create a fixture using the PolygonTools.CreateRectangle() function.

I noticed elsewhere on the forums here that very wide rectangles created this way do have some issues with collision and the recommendation is to subdivide the edges. But in FP3 there is no subdivision support (that I could find). Further, if I attempt to use the FP2 subdivision code in Vertices.cs, the fixture create fails because now I have colinear edges (of course).

So does anyone have any solutions for this?



Jun 4, 2010 at 12:54 PM
Farseer Physics Engine 3.0 uses SAT as the narrow phase algorithm and thus it is not necessary to subdivide edges (FPE 2.x uses distance grid narrow phase collider. It is necessary to subdivide edges). I'm not sure why your bodies are interpenetrating, have you looked at the Testbed sample with the pyramid? Try setting the density of each body to 1 - if you use very high density values, it can create weird behavior when stacking.