Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

https://farseerphysics.codeplex.com/documentation

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

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

3:   

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

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

6:   

7:  //Transfer the texture data to the array

8:  polygonTexture.GetData(data);

9:   

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);

12:   

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);

16:   

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

18:  _list = BayazitDecomposer.ConvexPartition(verts);

19:   

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.