You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var debugDraw = new Box2D.Dynamics.b2DebugDraw();
debugDraw.SetSprite(document.getElementById("test").getContext("2d")); // test is the id of another canvas which debugdraw works on
debugDraw.SetDrawScale(30.0);
debugDraw.SetFillAlpha(0.3);
debugDraw.SetLineThickness(1.0);
debugDraw.SetFlags(Box2D.Dynamics.b2DebugDraw.e_shapeBit | Box2D.Dynamics.b2DebugDraw.e_jointBit);
this.world.SetDebugDraw(debugDraw);
this.world.DrawDebugData();
and box2d use a different coordinate frame than cocos, so you need to do transform 180 degrees.
add this to the style of debug canvas
-webkit-transform:rotate(180deg); //and some other browsers' style
how to use b2debugDraw,the js-test.html model have not demonstrate
The text was updated successfully, but these errors were encountered: