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 rectangle shapes equal to the size of the texture I am fixing them to.

What would be the easiest way to do this? Is there a built in RectangleShape class is Farseer? Or will I have to create a PolygonShape and convert the 4 corners of my texture into vertices to create the shape? If so what is the easiest way of doing this?

Thanks in advance for the help.

EDIT

This is my current approach to this problem.

// Rectangle Texture Shape

Vertices vertices = new Vertices(4);
                    vertices.Add(new Vector2(0, 0));
                    vertices.Add(new Vector2(0, imageItemList[i].texture.Height));
                    vertices.Add(new Vector2(imageItemList[i].texture.Width, 0));
                    vertices.Add(new Vector2(imageItemList[i].texture.Width, imageItemList[i].texture.Height));

                    PolygonShape platShape =
                        new PolygonShape(vertices, 10f);

                    Fixture platFixture = platBody.CreateFixture(platShape);
share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.