Java Code Examples for com.badlogic.gdx.physics.bullet.Bullet#init()

The following examples show how to use com.badlogic.gdx.physics.bullet.Bullet#init() . 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: MenuScene.java    From Skyland with MIT License 5 votes vote down vote up
@Override
public void show() {
    Bullet.init();
    init3d();
    initScene2d();
    initRayCastListener();
}
 
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: BulletSteeringTest.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
public static void init () {
	if (initialized) return;
	// Need to initialize bullet before using it.
	if (Gdx.app.getType() == ApplicationType.Desktop && customDesktopLib != null) {
		System.load(customDesktopLib);
	} else
		Bullet.init();
	Gdx.app.log("Bullet", "Version = " + LinearMath.btGetVersion());
	initialized = true;
}