A re-implementation of debug drawing without the hassles of Box2D's API.
By drawing into Sprites which you persist through frames, the methods here
are appropriate for production release.
public var awakeColor:uint = 0xE6E6E6
public var fillAlpha:Number = 0.8
public var graphics:Graphics
public var jointColor:uint = 0x80CDCD
public var lineThickness:Number = 1
public var physScale:Number
public var sleepColor:uint = 0x8080E6
public var staticColor:uint = 0x80E680
public var xformScale:Number = 3
public function Box2DGraphics(graphics:Graphics, physScale:Number)
Creates a wrapper for Graphics, with it's own set of drawing properties.
Parameters
| graphics:Graphics — The Graphics object to wrap.
|
|
| physScale:Number — The scaling to use, in pixels/unit.
|
public function drawBody(body:b2Body):void
Draws a body, including styling.
Parameters
public function drawBodyLocal(body:b2Body):void
Draws a body in local co-ordinates, including styling.
Parameters
public function drawBodyOutline(body:b2Body):void
Draws the given body, without setting any style properties.
Use this instead of drawBody if you want a more customized looking shape.
Parameters
public function drawBodyOutlineLocal(body:b2Body):void
Draws the given body in local cordinates, without setting any style properties.
Use this instead of drawBodyLocal if you want a more customized looking shape.
Parameters
public function drawJoint(joint:b2Joint):void
Draws a joint, including styling.
Parameters
public function drawJointOutline(joint:b2Joint):void
Draws the given joint, without setting any style properties.
Use this instead of drawJoint if you want a more customized looking shape.
Parameters
public function drawSegment(p1:b2Vec2, p2:b2Vec2):void
Draws an unstyled line.
Parameters
public function drawShapeOutline(shape:b2Shape):void
Draws the given shape in world co-ordinates, without setting any style properties.
Use this instead of drawShape if you want a more customized looking shape.
Parameters
public function drawShapeOutlineLocal(shape:b2Shape):void
Draws the given shape in local co-ordinates, without setting any style properties.
Use this instead of drawShapeLocal if you want a more customized looking shape.
Parameters
public function drawWorld(world:b2World):void
Draws a world, including styling. Note that it is more efficient to draw bodies into
separate DisplayObjects once, and then move them around, than to call drawWorld once
per frame.
Parameters