2
\$\begingroup\$

I am very new to game development and I am trying to debug my 3d collision bounds. Could somebody give me an example on how to draw the collision bounds of an object in libGDX?

I assume it has something to do with btIDebugDraw but I can't find any examples on how to draw them.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

You can use the setDebugMode() method of the BulletWorld class. The argument that you specify is an int depicting the mode. For example, you can use world.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE ) to draw every single debug option available. You can find a list of other modes from Bullet Physic's documentation here.

\$\endgroup\$
0
3
\$\begingroup\$

This approach works well for LibGDX 1.2.0

First of all you must create new instance of DebugDrawer and set debug mode you need:

debugDrawer = new DebugDrawer();
debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE);

Set this drawer to your btDynamicsWorld instance:

world.setDebugDrawer(debugDrawer); 

Display debug data in ApplicationAdapter.render() method:

debugDrawer.begin(camera);
world.debugDrawWorld();
debugDrawer.end();
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .