private void Constrain() {
		if (U.getTorus() == true) {
			if (x < (0 - U.world_x_pixels2)) {
				x += U.world_x_pixels;
			} else if (x > U.world_x_pixels2) {
				x -= U.world_x_pixels;
			}
			if (y < (0 - U.world_y_pixels2 + U.UI)) {
				y += U.world_y_pixels - U.UI;
			} else if (y > U.world_y_pixels2) {
				y -= U.world_y_pixels - U.UI;
			}
		} else {
			if (x < (0 - U.world_x_pixels2)) {
				PX = Math.abs(PX);
				//a = ((float) (+Math.PI - getHeading()));
				ChangeFrame();
			} else if (x + (2 * r) >= U.world_x_pixels2) {
				PX = -(Math.abs(PX));
				//a = ((float) (-Math.PI - getHeading()));
				ChangeFrame();
			}

			if (y < (0 - U.world_y_pixels2 + U.UI)) {
				PY = Math.abs(PY);
				//a = ((float) (2 * Math.PI - getHeading()));
				ChangeFrame();
			} else if (y + (2 * r) >= U.world_y_pixels2) {
				PY = -(Math.abs(PY));
				//a = ((float) (-2 * Math.PI - getHeading()));
				ChangeFrame();
			}
		}
	}