The interface of debug drawer. This provides graphical information of a physics world
for debugging softwares. Users should override at least three methods DebugDraw.point
,
DebugDraw.triangle
, DebugDraw.line
.
Constructor
Variables
drawBvh:Bool
Whether to draw the bounding volume hierarchy of the broad-phase collision
detection. If BvhBroadPhase
is not used, nothing will be drawn regardless
of the value of this parameter.
drawBvhMaxLevel:Int
The maximum depth of the BVH to be drawn. If DebugDrawer.drawBvh
is set to
false
, the entire BVH will not be drawn.
drawBvhMinLevel:Int
The minimum depth of the BVH to be drawn. If DebugDrawer.drawBvh
is set to
false
, the entire BVH will not be drawn.
Methods
aabb(min:Vec3, max:Vec3, color:Vec3):Void
Draws an axis-aligned bounding box.
min
is the minimum point of the AABB.
max
is the maximum point of the AABB.
color
is the color of the AABB.
arc(center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, startAngle:Float, endAngle:Float, drawSector:Bool, color:Vec3):Void
Draws an arc.
center
is the center of the arc.
ex
is the normalized x-axis vector of the arc.
ey
is the normalized y-axis vector of the arc.
radiusX
is the radius along the x-axis of the arc.
radiusY
is the radius along the y-axis of the arc.
startAngle
is the start angle of the arc in radians.
endAngle
is the end angle of the arc in radians.
drawSector
is whether to draw line segments between start/end point and center point.
color
is the color of the arc.
basis(transform:Transform, length:Float, colorX:Vec3, colorY:Vec3, colorZ:Vec3):Void
Draws the basis of a transform transform
.
length
is the length of the lines to be drawn.
colorX
is the color of the x-axis of the basis.
colorY
is the color of the y-axis of the basis.
colorZ
is the color of the z-axis of the basis.
box(tf:Transform, halfExtents:Vec3, color:Vec3):Void
Draws a box.
tf
is the transformation of the box.
halfExtents
is the half-extents of the box.
color
is the color of the box.
capsule(tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void
Draws a capsule locally along to the y-axis.
tf
is the transformation of the capsule.
radius
is the radius of the capsule.
halfHeight
is the half-height of the capsule.
color
is the color of the capsule.
cone(tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void
Draws a cone locally along to the y-axis. The center of the cone is in the middle of the vertex and the center of the base circle.
tf
is the transformation of the cone.
radius
is the radius of the base circle of the cone.
halfHeight
is the half-height of the cone. The local position of the vertex of
the cone is (0, halfHeight, 0)
.
color
is the color of the cone.
cylinder(tf:Transform, radius:Float, halfHeight:Float, color:Vec3):Void
Draws a cylinder locally along to the y-axis.
tf
is the transformation of the cylinder.
radius
is the radius of the cylinder.
halfHeight
is the half-height of the cylinder.
color
is the color of the cylinder.
ellipse(center:Vec3, ex:Vec3, ey:Vec3, radiusX:Float, radiusY:Float, color:Vec3):Void
Draws an ellipse.
center
is the center of the ellipse.
ex
is the normalized x-axis vector of the ellipse.
ey
is the normalized y-axis vector of the ellipse.
radiusX
is the radius along the x-axis of the ellipse.
radiusY
is the radius along the y-axis of the ellipse.
color
is the color of the ellipse.
line(v1:Vec3, v2:Vec3, color:Vec3):Void
Draws a line segment between v1
and v2
.
color
is the color of the line segment.
rect(v1:Vec3, v2:Vec3, v3:Vec3, v4:Vec3, n1:Vec3, n2:Vec3, n3:Vec3, n4:Vec3, color:Vec3):Void
Draws a rectangle.
v1
, v2
, v3
, v4
are the rectangle's vertices in CCW order.
n1
, n2
, n3
, n4
are the normals of the rectangle's vertices in CCW order.
color
is the color of the rectangle.