Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/.

like image 960
Eugene Krevenets Avatar asked Nov 16 '25 21:11

Eugene Krevenets


1 Answers

just use functions of context 2d of canvas:

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

like image 152
Eugene Krevenets Avatar answered Nov 18 '25 12:11

Eugene Krevenets