I'm working on a platformer where I'd like to be able to move or copy bodies between multiple Box2D b2Worlds. The desire has cropped up three times now - moving objects between documents in my editor, moving the player between levels in normal game play, and giving the player a preview of a non-trivial projectile they can shoot in the game, which seems to be most accurately done by simulating the world for a few seconds ahead.
It looks like I can make a parallel world the "long way" - for each body in the world, copy the body data back into a def and re-create it, then copy the fixtures on it in the same way, then do the same for joints; re-set all the velocities; and if it's a "move" rather than a "copy" delete the original one.
I was wondering if someone has already written this code (and if so, was it actually a workable design or not?), or if Box2D has some affordance for doing this within its API which I am missing.