com.badlogic.gdx.physics.bullet.DebugDrawer Java Examples

The following examples show how to use com.badlogic.gdx.physics.bullet.DebugDrawer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GameEngine.java    From GdxDemo3D with Apache License 2.0 5 votes vote down vote up
public GameEngine() {
	collisionConfig = new btDefaultCollisionConfiguration();
	dispatcher = new btCollisionDispatcher(collisionConfig);
	broadphase = new btDbvtBroadphase();
	constraintSolver = new btSequentialImpulseConstraintSolver();
	dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase,
			constraintSolver, collisionConfig);
	dynamicsWorld.setGravity(GameSettings.GRAVITY);

	debugDrawer = new DebugDrawer();
	dynamicsWorld.setDebugDrawer(debugDrawer);
	debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_DrawWireframe);
	contactListener = new CollisionContactListener();
}
 
Example #2
Source File: Physics.java    From gdx-proto with Apache License 2.0 5 votes vote down vote up
public Physics() {
	Bullet.init();
	shapes = new Array<>();
	objects = new Array<>();
	disposables = new Array<>();
	if (Main.isClient()) {
		debugDrawer = new DebugDrawer();
		debugDrawer.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_MAX_DEBUG_DRAW_MODE);
	}
	inst = this;
	collisionConfig = new btDefaultCollisionConfiguration();
	dispatcher = new btCollisionDispatcher(collisionConfig);
	broadphaseInterface = new btDbvtBroadphase();
	// TODO is it worth comparing performance with other broadphase types?
	//broadphaseInterface = new btSimpleBroadphase();
	//broadphaseInterface = new btAxisSweep3(tmp.set(0f, -10, 0f), tmp2.set(GameWorld.WORLD_WIDTH, 200f, GameWorld.WORLD_DEPTH));
	world = new btCollisionWorld(dispatcher, broadphaseInterface, collisionConfig);
	if (Main.isClient()) {
		world.setDebugDrawer(debugDrawer);
	}
	contactListener = new MyContactListener();

	disposables.add(world);
	if (debugDrawer != null) {
		disposables.add(debugDrawer);
	}
	disposables.add(collisionConfig);
	disposables.add(dispatcher);
	disposables.add(broadphaseInterface);
	disposables.add(contactListener);
}
 
Example #3
Source File: BulletWorld.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
public void setDebugMode (final int mode) {
	if (mode == btIDebugDraw.DebugDrawModes.DBG_NoDebug && debugDrawer == null) return;
	if (debugDrawer == null) collisionWorld.setDebugDrawer(debugDrawer = new DebugDrawer());
	debugDrawer.setDebugMode(mode);
}