class nape.util.Debug

Available on all platforms

Debug class providing general utilities *

* Also serves as the base type for Debug draws.

Class Fields

static function clearObjectPools():Void

Force clear all object pools, both internal and public.

static function createGraphic(body:Body):Shape

Create a flash/openfl||nme Shape representing the given Body. * *

body

The body to create display Shape for. *

returns

A flash/openfl||nme.display.Shape representing Body. *

static function version():String

Query Nape version

Instance Fields

var bgColour:Int

Background colour for debug draw display. *

* This value does not have much use for ShapeDebug, or for * a transparent BitmapDebug but will still be used in tinting * object colours to better fit an idealised background colour.

var colour:Null<Int ->Int>

User defined colour picking. *

* When not null, this method will be called to decide which colour * to use for an object with argument being the id of that object. *

* The return value should be an RGB value. * * @default null

var cullingEnabled:Bool

When true, objects outside the debug draw screen will not be drawn. *

* The debug draw screen is defined as the rectangle (0,0) -> (width,height). * To 'move' the debug draw screen in your world, you should modify the transform * property. *

* This culling has a cost, so is not worth enabling if everything is always on * screen anyways. * * @default false

var display:DisplayObject

The flash/openfl||nme native display object representing debug draw. *

* When using debug drawer, you should add this to your display list.

var drawBodies:Bool

If true, then all bodies in the space (whether active or not) will be drawn. * @default true

var drawBodyDetail:Bool

If true, then things like the body centre of mass, and bouncing box will be drawn. *

* This will only have an effect if drawBodies is true. * @default false

var drawCollisionArbiters:Bool

If true, a representation of contact patches will be drawn. *

* Only active arbiters are drawn. * @default false

var drawConstraints:Bool

If true, then representations of the active constraints will be drawn. * @default false

var drawFluidArbiters:Bool

If true, a representation of centres of buoyancy and overlap will be drawn. *

* Only active arbiters are drawn. * @default false

var drawSensorArbiters:Bool

If true, a representation of sensor interactions will be drawn. *

* Only active arbiters are drawn. * @default false

var drawShapeAngleIndicators:Bool

If true, then indicators of the shapes rotation will be drawn. *

* This will only have an effect if drawBodies is true. * @default true

var drawShapeDetail:Bool

If true, then things like shape centre of mass and bounding box will be drawn. *

* This will only have an effect if drawBodies is true. * @default false

var transform:Mat23

Transformation to apply to all debug draw operations. *

* This transform can be used to 'move' the debug draw screen through your * world as well as rotating and zooming in etc. *

* This transform effects 'all' debug draw operations and optimisation is in * place to not perform any transformation if matrix is the identity matrix. * * @default new Mat23()

var zpp_inner:ZPP_Debug

@private

function new():Void

@private

function clear():Void

Clear the debug view.

function draw(object:Dynamic):Void

Draw a Nape object to debug draw. *

* Possible argument types are: Space, Compound, Body, Shape, Constraint *

* To draw a Shape it must be part of a Body. *

* Debug draw settings like 'drawBodies' are overriden by a direct call to draw * with a Body or Shape. Equally even if drawConstraints is false, should * you call draw with a Constraint object directly it will be drawn regardless. * *

object

The object to draw. *

function drawAABB(aabb:AABB, colour:Int):Void

Draw AABB. *

* This AABB will be drawn with no thickness or fill. * *

aabb

The AABB to draw. *

colour

The colour to draw AABB with in RGB. *

function drawCircle(position:Vec2, radius:Float, colour:Int):Void

Draw circle. *

* This circle will be drawn with no thickness or fill. * *

position

The position of circle centre. *

radius

The radius of the circle. *

colour

The colour of circle in RGB. *

function drawCurve(start:Vec2, control:Vec2, end:Vec2, colour:Int):Void

Draw quadratic bezier curve. *

* This curve will be drawn with no thickness. * *

start

The start point of curve. *

control

The control point for curve. *

end

The end point of curve. *

colour

The colour of curve in RGB. *

function drawFilledCircle(position:Vec2, radius:Float, colour:Int):Void

Draw filled circle. *

* This circle will be drawn with no edges, only a solid fill. * *

position

The position of centre of circle. *

radius

The radius of circle. *

colour

The colour to draw circle with in RGB. *

function drawFilledPolygon(polygon:Dynamic, colour:Int):Void

Draw filled polygon. *

* This polygon will be drawn no edges, only a solid fill. *

* The polygon argument is typed Dynamic and may be one of: * Array<Vec2>, flash.Vector<Vec2>, Vec2List, GeomPoly * *

polygon

The polygon to draw. *

colour

The colour to draw polygon with in RGB. *

function drawFilledTriangle(p0:Vec2, p1:Vec2, p2:Vec2, colour:Int):Void

Draw filled triangle. *

* This triangle will be drawn with no edges, only a solid fill. * *

p0

The first point in triangle. *

p1

The second point in triangle. *

p2

The third point in triangle. *

colour

The colour to draw triangle with in RGB. *

function drawLine(start:Vec2, end:Vec2, colour:Int):Void

Draw a line segment. *

* This line will be drawn with no thickness. * *

start

The start point of line segment. *

end

The end point of line segment. *

colour

The colour of line in RGB. *

function drawPolygon(polygon:Dynamic, colour:Int):Void

Draw polygon. *

* This polygon will be drawn with no thickness or fill. *

* The polygon argument is typed Dynamic and may be one of: * Array<Vec2>, flash.Vector<Vec2>, Vec2List, GeomPoly * *

polygon

The polygon to draw. *

colour

The colour to draw polygon with in RGB. *

function drawSpring(start:Vec2, end:Vec2, colour:Int, ?coils:Int = 3, ?radius:Float = 3.0f):Void

Draw linear spring. *

* This spring will be drawn with no thickness. * *

start

The start point of spring. *

end

The end point of spring. *

colour

The colour of spring in RGB. *

coils

The number of coils in spring. (default 3) *

radius

The radius of spring. (default 3.0) *

function flush():Void

Flush any pending draw operations to debug view. *

* This operation is not needed for ShapeDebug at present.