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

Polygon physics problems

Aug 8, 2008 at 6:32 AM

I've created a plus-shaped block using the Polygon BodyFactory, and it interacts well enough with circles and squares, but for some reason will simply not work with other objects of the same type.
Two cross-shaped bodies using the same vertex set go through each other.


vertexSet =

new Vertices();



new Vector2(0, 28));



new Vector2(0, 46));



new Vector2(27, 46));



new Vector2(27, 75));



new Vector2(48, 75));



new Vector2(48, 46));



new Vector2(75, 46));



new Vector2(75, 28));



new Vector2(48, 28));



new Vector2(48, 0));



new Vector2(27, 0));



new Vector2(27, 28));



Aug 8, 2008 at 8:09 PM
Try changing the timestep, But... Ive never used SubDivide, but im pretty sure that it should be lower than the max edge youve already got. Try changing it to something like: 7 and it should work
Aug 9, 2008 at 1:20 AM
As Treacles said, try turning down the value in SubDivideEdges(). As I understand it, SubDivideEdges() divides an edge from (example) 400 pixels in length into 400 divided by let's say 10. So 500 should only be used when you have some very big polygons. I could be wrong on this.

If that does not solve your problem, you could try setting a collision grid size that is smaller than the default.
Aug 9, 2008 at 4:09 AM
Thank you for the input.
I've tried to lower the subdivide edges count, and it didn't work. Again, there is only a collision problem between two crosses, and the collision works fine between a cross and a square or a circle for instance.
Aug 9, 2008 at 3:47 PM
Hmmmmm, ill try to recreate your shape on BlitzMax and then see how it turns out... Ill tell you if it works for me
Aug 10, 2008 at 12:19 AM
Nope, It seems the Plus shape is pretty fucked up lol... Ive even tried making it pretty huge but it doesnt work?
Aug 11, 2008 at 12:28 AM
Just noticed that all my Polygons are doing it lol?
Aug 11, 2008 at 3:48 AM
I have not tried the provided polygon shape by the original poster, but I wanted to show there there is nothing wrong with a polygon that is formed as a plus sign.
I do know about the problem of polygons sliding into each other, but it does not seem to be the case with the plus signs.

Here is a picture of one of my games with some quickly made plus signs:

The reason I did it in the game was that I just provide it with a picture of a plus sign, and it will convert it into a farseer object with a texture. It was the easiest.
Aug 11, 2008 at 8:33 PM
Hmmmm, Have you changed Collision properties? Cos on my one i could change anything to have like 400 vertices, be half the size of the page and they still slip in as if there was only basic Vertices...

Also, what game is that???
Aug 12, 2008 at 12:58 PM
This is my settings:

PhysicsSimulator = new PhysicsSimulator(new Vector2(0, 150));
PhysicsSimulator.MaxContactsToDetect = 5;
PhysicsSimulator.MaxContactsToResolve = 2;
PhysicsSimulator.Iterations = 10;
PhysicsSimulator.BiasFactor = .4f;

If I remember correctly, It's the same settings as the demoes from Farseer.

The game is something i build upon the Farseer demoes with the "spider" (the claw in my game).
I've taken the spider, made it into a claw on a crane. The game is about collecting ingredients for diffrent recipes. It's a childrens game.


Aug 12, 2008 at 10:30 PM
Well, It has physics so you should post it to FM Eventually...
Aug 12, 2008 at 11:41 PM
What is FM?
Aug 13, 2008 at 12:00 AM
Aug 13, 2008 at 2:16 AM
Oh, okay. Did not know about that one. Looks fun.