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

Texture to vertices problems

Jul 6, 2009 at 5:44 AM
Edited Jul 6, 2009 at 5:55 AM

Hey guys,

I seem to be having an odd error with my texture to vertices implementation after upgrading from 2.0 to 2.1.1 - the vertices are created in odd clusters ( much different from in 2.0 ) there will be like 3-4 vertices on one side and then a cluster of 10-15 around one corner.

I've tried simplifying after creating the polygon but it does nothing (36 verticies before, 36 after):

verts = Vertices.CreatePolygon(data, polygonTexture.Width, polygonTexture.Height);

I've also tried using the overload that lets me set a hullTolerance but I'm not sure how to use it because it is of type List<Vertices> instead of just Verticies.

I want to try and use SAT for narrow phase (because of the performance boost) but it also apparently needs very simple polygons with fewer verticies so I'd really like to try and solve this problem!

Any thoughts?

Jul 6, 2009 at 3:48 PM

The texture to vertices implementation was upgraded in 2.1. It should be faster and with support of holes and multiple textures.

As you mentioned, you can use the tolerance to adjust the details of the algorithm. It returns a list of vertices instead of a single vertices collection. This is because of the multiple texture detection. You just use it as you normally do, but put the return value into a List<Vertices>. When you use the array, you simply write verticesList[0] to gain access to the first Vertices collection.