This project has moved and is read-only. For the latest updates, please go here.

Question about Texture->Vertices sample code

May 5, 2009 at 2:53 AM
One of the lines in the documentation is:
//Make sure that the origin of the texture is the centroid (real center of geometry)
Vector2 polygonOrigin = verts.GetCentroid();

What is this supposed to be used for?   It isn't referenced anywhere else in the sample code.
May 5, 2009 at 3:53 AM
If you made a geometry from a texture, the center position is sometimes offset a bit, so drawing the texture at the geometries position would be slightly out of alignment with the body.
May 5, 2009 at 8:55 AM
As robertdodd said, geometries are centered around the centroid, this is why you also need to draw it with the centroid as the origin.
It is described under "Known Issues" in the manual. Even tho it's not really an issue.