Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm creating a game with libgdx. For testing physics I use a Box2DDebugRenderer, which is not fast. When I want to release my full game, what should I use as a renderer?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I haven't used Box2D itself (only ports and things based off of it), but the name "Box2DDebugRenderer" suggests that you should not render anything that should be in the final product whatsoever based on it.

Use it to draw collision bounds and collision contact points. This is very useful visual information to see while you're developing your game. The game itself should have its own renderer. Isn't that part of what LibGDX is supposed to provide?

share|improve this answer
    
sorry but what do you mean with "Use it to draw collision bounds and collision contact points" ? –  Ion Farima Feb 20 '13 at 13:04
    
@IonFarima Each object in your Box2D scene has a Body and Collision Shape associated with it that is used to determine its interactions and collisions with other bodies. The shape is not necessarily the same shape as the sprite/other visuals you associate the physics body with. So you turn on this debug renderer so you can see what the actual internal shapes Box2D is using to calculate collisions look like. Contact points are the points along bounding boxes where two bounding boxes have collided. –  michael.bartnett Feb 20 '13 at 15:15

It depends on what you want to render :) Box2d needs step updating to simulate physics only.

world.step(boxStep, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

if (DEBUG_PHYSICS) {
    debugRenderer.render(world, camera.combined.scale(100f * PHYSICS_SCALE, 100f * PHYSICS_SCALE, 0));
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.