Box2D 3.2.0
A 2D physics engine for games
Loading...
Searching...
No Matches
b2DebugDraw Struct Reference

This struct holds callbacks you can implement to draw a Box2D world. More...

#include <types.h>

Data Fields

void(*) DrawPolygonFcn (b2WorldTransform transform, const b2Vec2 *vertices, int vertexCount, b2HexColor color, void *context)
 Draw a closed polygon provided in CCW order.
void(*) DrawSolidPolygonFcn (b2WorldTransform transform, const b2Vec2 *vertices, int vertexCount, float radius, b2HexColor color, void *context)
 Draw a solid closed polygon provided in CCW order.
void(*) DrawCircleFcn (b2Pos center, float radius, b2HexColor color, void *context)
 Draw a circle.
void(*) DrawSolidCircleFcn (b2WorldTransform transform, b2Vec2 center, float radius, b2HexColor color, void *context)
 Draw a solid circle.
void(*) DrawSolidCapsuleFcn (b2Pos p1, b2Pos p2, float radius, b2HexColor color, void *context)
 Draw a solid capsule.
void(*) DrawLineFcn (b2Pos p1, b2Pos p2, b2HexColor color, void *context)
 Draw a line segment.
void(*) DrawTransformFcn (b2WorldTransform transform, void *context)
 Draw a transform. Choose your own length scale.
void(*) DrawPointFcn (b2Pos p, float size, b2HexColor color, void *context)
 Draw a point.
void(*) DrawStringFcn (b2Pos p, const char *s, b2HexColor color, void *context)
 Draw a string in world space.
void(*) DrawBoundsFcn (b2AABB aabb, b2HexColor color, void *context)
 Draw a bounding box.
b2AABB drawingBounds
 World bounds used for debug draw. An empty box draws nothing.
float forceScale
 Scale to use when drawing forces.
float jointScale
 Global scaling for joint drawing.
bool drawContacts
 Option to draw contact points.
bool drawAnchorA
 Draw anchor A for contact points (instead of anchorB).
bool drawShapes
 Option to draw shapes.
bool drawChainNormals
 Option to draw chain shape normals.
bool drawJoints
 Option to draw joints.
bool drawJointExtras
 Option to draw additional information for joints.
bool drawBounds
 Option to draw the bounding boxes for shapes.
bool drawMass
 Option to draw the mass and center of mass of dynamic bodies.
bool drawBodyNames
 Option to draw body names.
bool drawGraphColors
 Option to visualize the graph coloring used for contacts and joints.
bool drawContactFeatures
 Option to draw contact feature ids.
bool drawContactNormals
 Option to draw contact normals.
bool drawContactForces
 Option to draw contact normal forces.
bool drawFrictionForces
 Option to draw contact friction forces.
bool drawIslands
 Option to draw islands as bounding boxes.
void * context
 User context that is passed as an argument to drawing callback functions.

Detailed Description

This struct holds callbacks you can implement to draw a Box2D world.

Callbacks receive world coordinates. In large world mode the translation is double precision so it stays accurate far from the origin. Shift into your own camera frame inside the callbacks. Initialize with b2DefaultDebugDraw.

Field Documentation

◆ DrawBoundsFcn

void(*) b2DebugDraw::DrawBoundsFcn(b2AABB aabb, b2HexColor color, void *context)

Draw a bounding box.

With double precision enabled, the single precision bounding box gets increasing padding when moving far from the origin.


The documentation for this struct was generated from the following file:
  • E:/box/box2d/include/box2d/types.h