EDIT:
Thanks guys, got it! appears that the explode() function was called from the old object, rather then it’s new clone! 🙂
I have a hashtable of such objects
class BodyDataObj implements Cloneable {
World world;
Body body;
protected BodyDataObj clone() throws CloneNotSupportedException {
return (BodyDataObj) super.clone();
}
}
when needed, I make a clone of a needed object from the hashtable
BodyDataObj bodyDataMaster = bdoTable.get(name);
BodyDataObj bodyData = null;
try {
bodyData = (BodyDataObj) bodyDataMaster.clone();
} catch (CloneNotSupportedException e) {
// Handle error
}
bodyData.world = world;
bodyData.body = body;
and pass the world and body objects to my already cloned bodyData object.
Yet when I try to access this world and body object from within the BodyDataObj object, I get a NullPointException, as if they are cloned blanks.
Any ideas how to fix that?
Thanks!
From the answer to the comment the answer seems to be this:
b.getWorldCenter() returns null.