Debug Drawing

I’ve been reading Jason Gregory’s book Game Engine Architecture a lot lately. In Chapter 9 “Tools for Debugging and Development” he talks about how Naughty Dog use their own debug drawing API to visualize the results of mathematical calculations. I decide that this was a very nice simple feature to implement in my own physics engine.

Debug Drawing Manager.
You can draw lines, spheres, points (which are represented as crosses because a single pixel is hard to see), bounding boxes, coordinate axes.

The debug draw manager is define globally and can be called from anywhere in the physics engine.

Some examples that i have used debug drawing include:

  • Visualizing the normal’s of the cloth.
  • Direction of the wind in the physics scene.
  • Visualizing the position and orientation of a body with an axis.

I will have more uses for debug drawing when i get into writing collision detection for rigid bodies. I can then use it for:

  • Visualizing contact points on rigid bodies.
  • The bounding box of a rigid body.

I have the source of the debug draw manager i implemented in my physics engine on GitHub, Debug-Draw-Manager

Jason Gregory’s Book: Game Engine Architecture

Posted in C++

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s