This project has moved. For the latest updates, please go here.

Scale problem using texture to vertices

Topics: User Forum
Mar 6, 2011 at 1:29 PM

Using a class I wrote based on (and, at the moment, almost exactly like) modified TexturesToVerticesTest-code, I'm having an issue where certain scales will cause an index out of range error on line 18 of BayazitDecomposer.cs (return vertices[i < 0 ? s - (-i%s) : i%s];).

Does anyone have an idea of what could be causing this problem? I'm running Farseer 3.2. For example, Vector2 scale = new Vector2(0.04f, 0.04f); causes the error to appear while Vector2 scale = new Vector2(0.03f, 0.03f); works just fine.

Simply loading up my image in the testbed should demonstrate the issue. Oh, and I changed MaxPolygonVertices to 32 in settings.cs, I'm not sure if it will load unless that is done as well.

Here's the image I use to generate the vertices:


Mar 6, 2011 at 2:14 PM

Use another decomposer. Try out EarClipDecomposer.

Mar 6, 2011 at 2:16 PM

Alright, I'll try that and report back after I've had some sleep. Thank you, and thanks a lot for making Farseer!

Mar 6, 2011 at 2:20 PM

Actually, I just tried it and it works perfectly. Thanks again.