OutOfBounds Exception when creating a PolygonShape using jbox2d

Posted by B3nGr33ni3r on Game Development See other posts from Game Development or by B3nGr33ni3r
Published on 2012-12-09T01:41:34Z Indexed on 2012/12/09 5:20 UTC
Read the original article Hit count: 226

Filed under:
|

So here's the deal, i'm parsing a file that contains the vertices for a polygon, that i want to create in box2d. I create a new PolygonShape() and then call .set() giving it a defined array of Vec, and that defined array's .length property. I expected this to work, since the documentation for jbox2d says this method takes a Vec array, and the count of Vec objects in that array. However, it errors out, and it seems to be unrelated to my code. The error i get is

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
    at org.jbox2d.collision.shapes.PolygonShape.set(PolygonShape.java:174)
and, upon looking at that line in the jbox2d svn repository, i still cannot figure out the issue.

Any help is appreciated!

© Game Development or respective owner

Related posts about java

Related posts about jbox2d