Russian dolls style penetration of same sized polygon geom.

Topics: User Forum
Oct 21, 2008 at 9:00 PM
Edited Oct 21, 2008 at 9:05 PM

Hi all! :)

I'm having an issue with Farseer, where I have a stack of identically sized rectangles (though created with CreatePolygonGeom, not CreateRectangular) like so:

The problem is that when I run the physics on it, it is as if they all slot inside each other as soon as they are aligned with each other and touching, a bit like russian dolls, like they are all hollow or something. While pushing them around I'll eventually have all of the geometry occupying the same space as they'll drop into eachother as soon as the verts are aligned. I've tried different penetration levels, different collision grid sizes, but nothing seems to stop it :-\

Not sure why this is happening, as collision works perfectly in other situations :\

Any suggestions? Thanks!

Oct 21, 2008 at 9:46 PM
Edited Oct 21, 2008 at 9:53 PM
I guess you only have vertices at the corners?

Try adding some more along the sides. You can use Vertices.SubDivideEdge() to add more vertices along the edges.

Edit: I'm wondering how you got the second picture with Farseer. Farseer works in 2d, and that second picture is 3d or does my eyes deceive me? 
Oct 21, 2008 at 10:15 PM
Hi, thanks for the info, will try that! :)

The game itself creates 3D geometry from 2D, it's like a LittleBigPlanet 3D side on platformer engine, but all physics and collision is 2D
Oct 21, 2008 at 10:18 PM
Works a treat. Thank you! :D
Oct 21, 2008 at 10:24 PM
Great lemmy101. Seems like a really nice project you got going there. Happy to help.
Oct 21, 2008 at 11:54 PM
@lemmy - great to see someone else is gonna use the engine with a 3D view. I am scrapping together a tank racing game with a view much like yours. Are you using the actual Geom vertices to create your blocks? I will just be attaching models to the body position/rotation with the Farseer model doing all the collision and physics work.

Oh and genbox is right you need more vertices along the sides of your box to make it collide properly.
Oct 22, 2008 at 12:12 AM
Hi Matt! :) Thanks! The geometry is put down in the editor, for floors, walls and moving physics objects etc, and is used directly by Farseer, but also allows placement of 3D models in the poly geometry, which will then be given a rectangle geom verts or whatever is appropriate.