Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a polygon in Farseer. I found an example in the documentation but it's not working because I get this error message: The type or namespace name 'Vertices' could not be found (are you missing a using directive or an assembly reference?)

Which using directive is missing?

1:  //load texture that will represent the physics body

2:  Texture2D polygonTexture = GameInstance.Content.Load<Texture2D>("Texture");


4:  //Create an array to hold the data from the texture

5:  uint[] data = new uint[polygonTexture.Width * polygonTexture.Height];


7:  //Transfer the texture data to the array

8:  polygonTexture.GetData(data);


10:  //Find the vertices that makes up the outline of the shape in the texture

11:  Vertices verts = PolygonTools.CreatePolygon(data, polygonTexture.Width, polygonTexture.Height, true);


13:  //For now we need to scale the vertices (result is in pixels, we use meters)

14:  Vector2 scale = new Vector2(0.07f, 0.07f);

15:  verts.Scale(ref scale);


17:  //Since it is a concave polygon, we need to partition it into several smaller convex polygons

18:  _list = BayazitDecomposer.ConvexPartition(verts);


20:  //Create a single body with multiple fixtures

21:  List<Fixture> compund = FixtureFactory.CreateCompoundPolygon(World, _list, 1);

22:  compund[0].Body.BodyType = BodyType.Dynamic;
share|improve this question
up vote 0 down vote accepted

Vertices is in Farseer, in the namespace FarseerPhysics.Common:

using FarseerPhysics.Common;
share|improve this answer
It works. Thanx. – Bryan May 13 '13 at 12:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.