public int wrap(final Body s, final int sides) {
		Vector2D pos = s.getPosition();
		double px = pos.getX();
		double py = pos.getY();
		int event = 0;
		boolean pChange = false;

		if (px < -s.getWidth()) {
			if ((sides & SIDE_WEST) != 0) {
				px = width;
				pChange = true;
			}
			event = SIDE_WEST;
		} else if (px > width) {
			if ((sides & SIDE_EAST) != 0) {
				px = -s.getWidth();
				pChange = true;
			}
			event = SIDE_EAST;
		}

		if (py < -s.getHeight()) {
			if ((sides & SIDE_NORTH) != 0) {
				py = height;
				pChange = true;
			}
			event = SIDE_NORTH;

		} else if (py > height) {
			if ((sides & SIDE_SOUTH) != 0) {
				py = -s.getHeight();
				pChange = true;
			}
			event = SIDE_SOUTH;
		}
		if (pChange) {
			s.setPosition(new Vector2D(px, py));
		}
		return event;

	}