Search code examples
javascriptdebuggingbox2dgame-physicsphysics-engine

How to change position of debug draw visualization of Box2D.js?


I'm creating game with the world bigger than screen. So i need to move Debug Draw according to visualization. In flash port to archive this issue we are usually move DisplayObject that uses as target of Debug Draw but in javascript port of Box2D Debug Draw lacks of this possibilities? Or i miss something?

I have used box2dweb javascript port of Box2DFlash 2.1a https://code.google.com/p/box2dweb/.


Solution

  • just use functions of context 2d of canvas:

    context.translate(canvasOffset.x, canvasOffset.y); context.scale(scale,scale);