How does' box2d 'move the entire physical world?

How does’ box2d 'move the entire physical world?

I created a container to display object maps,
A picture was placed inside the container as a background image,
The container contains game character animations,
The keyboard controls this’ body 'to move,
Map container xy synchronizes body xy,
The ground container has moved, but the obstacle body on the map remains in place. Therefore, all bodies on the map need to be moved together because I need to perform camera movement (inspection) and move all bodies. I would like to ask if there is a global method to move the entire physical world at once? Thank you

I use ‘box2d’ in my game,
But my game map container is infinitely large,
So we need to scroll the map container, so all physical objects need to move together

Excessive movement speed leads to object penetration

package;

import openfl.Lib;
import openfl.Assets;
import openfl.display.Bitmap;
import box2D.collision.shapes.B2CircleShape;
import box2D.collision.shapes.B2PolygonShape;
import box2D.common.math.B2Vec2;
import box2D.dynamics.B2Body;
import box2D.dynamics.B2BodyDef;
import box2D.dynamics.B2DebugDraw;
import box2D.dynamics.B2FixtureDef;
import box2D.dynamics.B2World;
import openfl.display.Sprite;
import openfl.events.Event;

class Main extends Sprite {
	private static var PHYSICS_SCALE:Float = 1 / 30;

	private var PhysicsDebug:Sprite;
	private var World:B2World;

	private var node:Sprite;
	private var bg:Bitmap;
	private var boo:Bool = false;
	private var ii:Int = 0;
	private var arr0:Array<B2Body> = [];

	public function new() {
		super();

		node = new Sprite();
		node.scaleX = 0.4;
		node.scaleY = 0.4;
		node.x = 50;
		node.y = 50;
		this.addChild(node);

		bg = new Bitmap(Assets.getBitmapData("image/bg.png"));
		bg.x = 0;
		bg.y = 0;
		node.addChild(bg);

		World = new B2World(new B2Vec2(0, 10.0), true);
		PhysicsDebug = new Sprite();
		addChild(PhysicsDebug);

		var debugDraw = new B2DebugDraw();
		debugDraw.setSprite(PhysicsDebug);
		debugDraw.setDrawScale(1 / PHYSICS_SCALE);
		debugDraw.setFlags(B2DebugDraw.e_shapeBit);
		World.setDebugDraw(debugDraw);

		arr0.push(createBox(node.x + 10, node.y + node.height / 2, 10, node.height, false));
		arr0.push(createBox(node.x - 10 + node.width, node.y + node.height / 2, 10, node.height, false));
		arr0.push(createBox(node.x + node.width / 2, node.y + node.height - 10, bg.width / 2, 10, false));

		Lib.setTimeout(function() {
			boo = true;
		}, 3000);

		addEventListener(Event.ENTER_FRAME, this_onEnterFrame);
	}

	private function createBox(x:Float, y:Float, width:Float, height:Float, dynamicBody:Bool):B2Body {
		var bodyDefinition = new B2BodyDef();
		bodyDefinition.allowSleep = false;
		bodyDefinition.position.set(x * PHYSICS_SCALE, y * PHYSICS_SCALE);

		if (dynamicBody) {
			bodyDefinition.type = B2Body.b2_dynamicBody;
		}

		var polygon = new B2PolygonShape();
		polygon.setAsBox((width / 2) * PHYSICS_SCALE, (height / 2) * PHYSICS_SCALE);

		var fixtureDefinition = new B2FixtureDef();
		fixtureDefinition.shape = polygon;

		var body = World.createBody(bodyDefinition);
		body.createFixture(fixtureDefinition);
		return body;
	}

	private function createCircle(x:Float, y:Float, radius:Float, dynamicBody:Bool):B2Body {
		var bodyDefinition = new B2BodyDef();
		bodyDefinition.position.set(x * PHYSICS_SCALE, y * PHYSICS_SCALE);

		if (dynamicBody) {
			bodyDefinition.type = B2Body.b2_dynamicBody;
		}

		var circle = new B2CircleShape(radius * PHYSICS_SCALE);

		var fixtureDefinition = new B2FixtureDef();
		fixtureDefinition.shape = circle;

		var body = World.createBody(bodyDefinition);
		body.createFixture(fixtureDefinition);
		return body;
	}

	// Event Handlers

	private function this_onEnterFrame(event:Event):Void {
		ii += 1;

		if (ii < 50) {
			createBox(200 + Math.random() * 100 - 50, node.y, 20, 20, true);
		}
		if (boo == true) {
			var oldNodeX:Float = node.x;
			var oldNodeY:Float = node.y;
			node.x += 15;

			for (i in 0...arr0.length) {
				var body:B2Body = arr0[i];
				var po:B2Vec2 = body.getPosition();

				// 物理坐标 → 像素坐标
				var bodyPixX:Float = po.x / PHYSICS_SCALE;
				var bodyPixY:Float = po.y / PHYSICS_SCALE;

				// 用旧 node 坐标计算偏移
				var offsetX:Float = bodyPixX - oldNodeX;
				var offsetY:Float = bodyPixY - oldNodeY;

				// 新位置 = 新 node 坐标 + 偏移
				var newPixX:Float = node.x + offsetX;
				var newPixY:Float = node.y + offsetY;
				body.setPosition(new B2Vec2(newPixX * PHYSICS_SCALE, newPixY * PHYSICS_SCALE));
			}
		}
		World.step(1 / 30, 10, 10);
		World.clearForces();
		World.drawDebugData();
	}
}