Problem creating polygon from vertices

Topics: Developer Forum, User Forum
May 28, 2014 at 4:58 PM
Edited May 28, 2014 at 4:59 PM
I'm trying to create a PolygonShape from Vertices. The problem is that the PolygonShape gets the wrong amount of vertices. I might be using the PolygonShape class wrong, I'm new to Farseer.
Does anyone have a solution/tips for me?
Here's the code:
public PolygonCollider(Vertices startPositions, Vertices endPositions, float awake, float death, float start, float end, bool willBeConcave)
{
          if (startPositions.Count > Settings.MaxPolygonVertices)
          {
                    Settings.MaxPolygonVertices = startPositions.Count;
          }
          _currentPositions = new Vertices(startPositions);
          _polygonShape = new PolygonShape(_currentPositions, 1.0f);
          Console.WriteLine("Vertex count from poly shape: " + _polygonShape.Vertices.Count);                            

          Console.WriteLine("Vertex count from vertices list: " + _currentPositions.Count);
}
The ouput are:
Vertex count from poly shape: 8
Vertex count form vertices list: 17
Vertex count from poly shape: 5
Vertex count form vertices list: 5
Vertex count from poly shape: 4
Vertex count form vertices list: 7
Vertex count from poly shape: 3
Vertex count form vertices list: 3
Vertex count from poly shape: 6
Vertex count form vertices list: 6
Jun 25, 2014 at 10:26 AM
Hi,

why don't you use the CreateCompoundPolygon ?
Body b = FarseerPhysics.Factories.BodyFactory.CreateCompoundPolygon(physicWorld, vertices, 1f);