1
Support / world.removeObject(Object3D) crash
« on: October 04, 2013, 08:24:22 pm »
I have a bunch of tiles in my world (a 16x16 array for now, but only a circle of them are created) and some have houses on them. In the array is a Tile object, which holds the tile information such as the height, the tile model (a hexagon) and it's child if it has one. The tile position is stored in the model's name so I can access it through picking. In a touch event, I am removing the house of the tile if it has one, using this code:
I believe it happens because the touchEvent happens after the world stuff and before the rendering.
How can I solve this? Thanks
Code: [Select]
String name = ((Object3D) res[1]).getName();
int foundTileX = Integer.parseInt(name.replace("Tile_", "").split(";")[0]);
int foundTileY = Integer.parseInt(name.replace("Tile_", "").split(";")[1]);
Tile foundTile = map.tiles[foundTileX][foundTileY];
if(foundTile.child!=null){
world.removeObject(foundTile.child);
foundTile.child=null;
}
However, as soon as a house is removed, the game crashes with this error:I believe it happens because the touchEvent happens after the world stuff and before the rendering.
How can I solve this? Thanks