This project has moved. For the latest updates, please go here.

Farseer Physics 3.5 texture to multipolygon

Topics: Developer Forum, Project Management Forum, User Forum
Dec 22, 2013 at 8:49 PM
From this I'm trying to get the texture polygons. But they do not appear correctly.
In this discussion is an example, but it does not work with version 3.5. How to make what I need?

This is my texture:

I've been doing and not only:
data = new uint[(BlockTexture.Width) * (BlockTexture.Height)];
            Vertices verts = PolygonTools.CreatePolygon(data, (BlockTexture.Width), false);
            Vector2 scale = new Vector2(CoordinateHelper.pixelToUnit * scale_, CoordinateHelper.pixelToUnit * scale_);
            verts.Scale(ref scale);
            BlockOrigin = verts.GetCentroid();
            Vector2 vertsTranslate = -BlockOrigin;
            verts.Translate(ref vertsTranslate);
            list = FarseerPhysics.Common.Decomposition.Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Bayazit, true);
            //list = EarclipDecomposer.ConvexPartition(verts);
            bodyBlock = BodyFactory.CreateCompoundPolygon(world, list, density, bodyBlock);