How to Box2D Physical world Move/Zoom

Hi everyone!

I’m developing a physics game using cocos2d-x and box2d.

The stage map exists and i want to implement a map move/zoom.

When the coordinates and size of the map(cocos2d::Node) change, the physical world must also be synchronized.

How can I implement it in this case?

Can you show an example of the effect you want to achieve? Are you using v3 or v4?

I am using v3.17.2.

Unfortunately, I can’t show an example at the moment because it’s being implemented.

Let me explain in more detail.

  • Created on a physics body based on 200x200 sprites and then synchronized
  • Scale the screen 2x, then the sprite created earlier will be displayed as 400x400

Questions

  • Can the physical world scale to fit the scaled screen?

Answer: Yes!
The screen is “only” the view on your physics world.
maybe look on the box2d testbed (there you can zoom/move) the whole physic world on the screen.