Using java Syntax Highlighting
- public void resetPhysics() {
- mPhysicsWorld.getPhysicsConnectorManager().clear();
- Iterator<Joint> joints = mPhysicsWorld.getJoints();
- while (joints.hasNext()) {
- Joint j = joints.next();
- if (j != null) mPhysicsWorld.destroyJoint(j);
- }
- Iterator<Body> bodies = mPhysicsWorld.getBodies();
- while (bodies.hasNext()) {
- Body b = bodies.next();
- if (b != null) mPhysicsWorld.destroyBody(b);
- }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
EDIT: Also, I'm not sure if I should create a new PhysicsWorld every time I change the level or reset the PhysicsWorld.
EDIT: (I think) I fixed my problem by creating a new PhysicsWorld every time I change the level and calling PhysicsWorld.dispose() by itself (don't need to destroy bodies, etc.) when I no longer needed it.

