Thanks for your reply.
I thought I read somewhere that the append method doesn't work for arrays of objects. Well, it seems to do, so that cleans up the code. Thanks. Doesn't solve the problem however.
The constructor takes three floats as parameters. To be sure, I tried if appending all constants with '.0' changes anything, but it didn't.
Looking again at the code, I see the use of the new method is not the only thing that has changed. Previously I did something like this:
Code:body = new CircBody(0.0, 0.0, 10.0);
body.add_child(new CircBody(-1.0, 100.0, 20.0));
...
CircBody child = new CircBody(0.0, 0.0, 10.0);
child.add_child(new CircBody(0.0, 1.0, 50.0));
...
body.add_child(child);
So I add the children to a object before I made that object a child of some other object. Since the children are now created by their parent, I now have to do something like this:
Code:body = new RectBody(0.0, 0.0, 10.0);
body.add_child(-1.0, 100.0, 20.0);
...
body.add_child(0.0, 0.0, 10.0);
body.child(3).add_child(0.0, 1.0, 50.0);
So I now add the children to an object, while the object is already a child of an other object.
Could this be the problem? I have a c++ background. In c++ the new code would not work if children is a vector of CircBody objects as I would be changing the size of the objects stored in the vector (using pointers would solve this, but has some other disadvantages). I am not sure how this works in java. Am I allowed to add children to an object when that object is stored in an array?