I have created a simple alien character made of multiple shapes, and the physics for this character are behaving correctly, but of the 2 polygons that are attached to the body, only one or the other can be seen on the screen - one seems to be invisible (it cannot be seen but objects will collide with it nonetheless). I can manipulate the code to choose which polygon is drawn, just by changing the order that the fixtures are created in the code. Basically, the polygon that is drawn, is the shape that is attached to the fixture that was created last in my code. I have tried to find an answer in the box2d and jbox2d documentations, and on the box2d forum, but I have hit a brick wall. Any insight would be appreciated.
Here is an image that shows the problem. The program just creates new alien objects in the mouse location whilst mousePressed is true, then gravity is acted upon the objects
There is a right 'antenna' there, with collisions being detected correctly for it, but it is invisible
I can change the order of the fixtures being created to choose which antenna is drawn and which one is invisible in this part of the code (inside the Alien class)
body.createFixture(cs, 1);
body.createFixture(csl, 1);
body.createFixture(csr, 1);
// right antenna
body.createFixture(ps, 1);
// left antenna
body.createFixture(ps2, 1);
... the left antenna is rendered correctly because it is the last one created. I have now idea why the other antenna is invisible, they are both drawn with the same method
Here is all the code (requires the PBox2D library)