Im working with Box2D on LibGDX, and I'm working with bodies and collisions etc..
HERE, i had the problem of a body colliding with another, when it shouldn't do that.
Now after Knowing that i need to use ChainShapes, i started with that.
Whenever u run my project, i get an assertion error:
Assertion failed: (count >= 2), function CreateChain, file /Users/tom/Coding/slave/workspace/libgdx-mac/extensions/gdx-box2d/gdx-box2d/jni/Box2D/Collision/Shapes/b2ChainShape.cpp, line 62.
So i tried a small debug to print the vertex count, and the vertex out printed as 0.
Problem is that i am adding the vertices and they dont appear to be added...
Code for adding verticies:
chain = new ChainShape();
chain.setNextVertex(new Vector2((posx - size) / PPM, (posy + size) / PPM));
chain.setNextVertex(new Vector2((posx + size) / PPM, (posy + size) / PPM));
chain.setNextVertex(new Vector2((posx + size) / PPM, (posy - size) / PPM));
chain.setNextVertex(new Vector2((posx - size) / PPM, (posy - size) / PPM));
System.out.println(chain.getVertexCount());
Vertex count is printed as 0, thats why i am getting the error, I dont know how to fix it, so please help :)
posx
,posy
,size
,PPM
– Abhishek Aryan