当前位置: 首页>>代码示例>>Java>>正文


Java Bullet类代码示例

本文整理汇总了Java中com.badlogic.gdx.physics.bullet.Bullet的典型用法代码示例。如果您正苦于以下问题:Java Bullet类的具体用法?Java Bullet怎么用?Java Bullet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Bullet类属于com.badlogic.gdx.physics.bullet包,在下文中一共展示了Bullet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public static void init()
{
	if(init)
		return;
	init = true;
	
	String javaScript = "ammo.js";
	
	final String js = GWT.getModuleBaseForStaticFiles() + javaScript;

	ScriptInjector.fromUrl(js).setCallback(new Callback<Void, Exception>()
	{
		@Override
		public void onFailure(Exception e)
		{
			GWT.log("inject " + js + " failure " + e);
		}

		@Override
		public void onSuccess(Void ok)
		{
			Bullet.initVariables();
		}
	}).setWindow(ScriptInjector.TOP_WINDOW).inject();
}
 
开发者ID:xpenatan,项目名称:gdx-bullet-gwt,代码行数:26,代码来源:GwtBullet.java

示例2: reconstructBody

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public void reconstructBody() {
    if(body != null) {
        body.dispose();
        body = null;
    }
    btCollisionShape shape = Bullet.obtainStaticNodeShape(gameWorld.renderer().getRenderable(this).nodes);
    if(shape != null)
        gameWorld.renderer().buildBulletCollision(this, shape);
    if(body != null) {
        btMotionState state = body.getMotionState();
        if(state instanceof DefaultMotionState) {
            ((DefaultMotionState)state).transform = this.transform;
        }
    }
    switch(physicsState) {
        case STATIC: setStatic(); break;
        case KINEMATIC: setKinematic(); break;
        case DYNAMIC: setDynamic(); break;
    }
    body.setWorldTransform(transform);
    gameWorld.addInstance(this);
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:23,代码来源:BulletEntity.java

示例3: SimulationRunner

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public SimulationRunner() {
    logger.info("Loading models");
    ModelBuilder builder = new ModelBuilder();
    models.put("box", builder.createBox(5f, 5f, 5f,
            new Material(ColorAttribute.createDiffuse(new Color(0.8f, 0f, 0f, 0f))),
            VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal));

    G3dModelLoader loader = new G3dModelLoader(new JsonReader());
    models.put("hub", loader.loadModel(Gdx.files.internal("data/hubreal.g3dj")));
    models.put("rim", loader.loadModel(Gdx.files.internal("data/rimreal.g3dj")));
    models.put("spoke", loader.loadModel(Gdx.files.internal("data/spoke.g3dj")));


    Bullet.init();
    logger.info("Initialized Bullet");
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:17,代码来源:SimulationRunner.java

示例4: onInit

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
@Override
protected void onInit() {
    logger.info("initializing physics");
    new SharedLibraryLoader().load("gdx");
    Bullet.init();
    createPhysicsWorld();
    rayTestSolver.setWorld(mainWorld);
}
 
开发者ID:WarpOrganization,项目名称:warp,代码行数:9,代码来源:PhysicsTask.java

示例5: initPhysics

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
private void initPhysics() {
    Bullet.init();

    collisionConfiguration = new btDefaultCollisionConfiguration();
    collisionDispatcher = new btCollisionDispatcher(collisionConfiguration);
    dbvtBroadphase = new btDbvtBroadphase();
    constraintSolver = new btSequentialImpulseConstraintSolver();

    dynamicsWorld = new btDiscreteDynamicsWorld(collisionDispatcher, dbvtBroadphase, constraintSolver, collisionConfiguration);
    dynamicsWorld.setGravity(new Vector3(0f, -1f, 0f));

    physicsInitialized = true;
}
 
开发者ID:MovementSpeed,项目名称:nhglib,代码行数:14,代码来源:PhysicsSystem.java

示例6: buildComplexCollisionMesh

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public <T> void buildComplexCollisionMesh(WorldRenderer<T> renderer, T obj) {
    ModelInstance inst = renderer.getRenderable(obj);
    if(inst == null) return;

    btCollisionShape shape = Bullet.obtainStaticNodeShape(inst.model.nodes);
    if(shape != null)
        renderer.buildBulletCollision(obj, shape);
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:9,代码来源:PhysicsCore.java

示例7: show

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
@Override
public void show() {
    Bullet.init();
    init3d();
    initScene2d();
    initRayCastListener();
}
 
开发者ID:ToxSickCoder,项目名称:Skyland,代码行数:8,代码来源:MenuScene.java

示例8: buildCave

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
private static void buildCave(Matrix4 transform) {
    Model caveModel = Assets.get(CURR_MODEL, Model.class);
    if (WORLD.getConstructor("cave") == null) {
        for (Node n : caveModel.nodes) n.scale.set(.6f, .6f, .6f);
        btCollisionShape collisionShape = Bullet.obtainStaticNodeShape(caveModel.nodes);
        collisionShape.setLocalScaling(new Vector3(.6f, .6f, .6f));
        WORLD.addConstructor("cave", new BulletConstructor(caveModel, 0, collisionShape));
    }
    BulletEntity cave = WORLD.add("cave", transform);
    cave.body.setCollisionFlags(cave.body.getCollisionFlags()
            | btCollisionObject.CollisionFlags.CF_KINEMATIC_OBJECT);
    cave.body.setActivationState(Collision.DISABLE_DEACTIVATION);
    cave.body.userData = new BulletUserData("cave", cave);
}
 
开发者ID:ToxSickCoder,项目名称:Skyland,代码行数:15,代码来源:Builder.java

示例9: generateBaseWorld

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public static BulletWorld generateBaseWorld(boolean grid, boolean debug) {
    BulletWorld world = new BulletWorld(new Vector3(0, -9.81f, 0));
    Builder.init(world); //Sets the stuff so you can use Builder class

    if (debug)
        world.setDebugMode(btIDebugDraw.DebugDrawModes.DBG_DrawWireframe | btIDebugDraw.DebugDrawModes.DBG_DrawFeaturesText | btIDebugDraw.DebugDrawModes.DBG_DrawText | btIDebugDraw.DebugDrawModes.DBG_DrawContactPoints);
    if (grid)
        world.add(new BulletEntity(ModelGenerator.generateAxis(-10, 10, 1), null));

    btCollisionShape collisionShape = Bullet.obtainStaticNodeShape(Assets.get(Models.MODEL_ISLAND_PROTOTYPE, Model.class).nodes.first(), true);
    world.addConstructor("island", new BulletConstructor(Assets.get(Models.MODEL_ISLAND_PROTOTYPE, Model.class), 0, collisionShape));
    return world;
}
 
开发者ID:ToxSickCoder,项目名称:Skyland,代码行数:14,代码来源:WorldGenerator.java

示例10: init

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
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;
}
 
开发者ID:Matsemann,项目名称:eamaster,代码行数:11,代码来源:BaseBulletTest.java

示例11: GameObjectBlueprint

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public GameObjectBlueprint(BlenderModel blenderModel, Model model) {
	this.model = model;
	setFromObject(blenderModel);
	this.mass = 0;
	ModelInstance modelInstance = new ModelInstance(model);
	GameModel.applyTransform(position, rotation, blenderModel.scale, modelInstance);

	this.shape = Bullet.obtainStaticNodeShape(modelInstance.nodes);
	this.shapeType = "static_node_shape_" + blenderModel.name;
	setCollisionFlags(this.mass);
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:12,代码来源:GameObjectBlueprint.java

示例12: initPhysics

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
/**
 * Creates the collision objects of this planet part.
 */
private void initPhysics() {
	for (int landscapeLayerIndex = 0; landscapeLayerIndex < planetConfig.layerConfigs.size(); landscapeLayerIndex++) {

		String partName = LANDSCAPE_NODE_NAME + landscapeLayerIndex;
		Node landscapeNode = model.getNode(partName);
		CollisionTypes landscapeType = CollisionTypes.byName(planetConfig.layerConfigs.get(landscapeLayerIndex).collisionType);

		if (areAllPartsValid(landscapeNode)) {
			btCollisionShape collisionShape = Bullet.obtainStaticNodeShape(landscapeNode, false);
			shapes.add(collisionShape);

			if (landscapeType != CollisionTypes.WATER) {
				float mass = 0;
				float friction = 1;
				PlanetConfig.LandscapeLayerConfig layerConfig = planetConfig.layerConfigs.get(landscapeLayerIndex);
				int userValue = CollisionTypes.byName(layerConfig.collisionType).mask;
				addRigidBody(collisionShape, mass, friction, userValue,
						new StandardMotionState(modelInstance.transform));
			} else {
				btCollisionObject object = new btCollisionObject();
				object.setCollisionShape(collisionShape);
				object.setWorldTransform(modelInstance.transform);
				object.setUserValue(CollisionTypes.WATER.mask);
				addCollisionObject(object);
			}
		}
	}
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:32,代码来源:PlanetPart.java

示例13: create

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
@Override
public void create () {
	app = this;
	gson = new GsonBuilder().setPrettyPrinting().create();
	loadConfig();
	Bullet.init();
	Models.init(); // needs an initialized Bullet
	loadSaveGame();
	TEXTURES = new TextureAtlas("textures/game.atlas");
	Styles.init(TEXTURES);
	TUTORIAL_CONTROLLER = new TutorialController(Styles.UI_SKIN);
	MULTIPLEXER = new InputMultiplexer();
	MULTIPLEXER.addProcessor(new InputController());
	Gdx.input.setInputProcessor(MULTIPLEXER);

	audioController = new AudioController();
	App.audioController.setSoundEnabled(App.config.playAudio);
	App.audioController.setMusicEnabled(App.config.playAudio);

	solarSystem = new SolarSystem();
	solarSystem.calculatePlanetPositions();


	if (config.debugMode) {
		SpaceShipProperties.properties.testInit();
		openSolarScreen();
	} else {
		openSplashScreen();
	}
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:31,代码来源:App.java

示例14: getCollisionShape

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
public btCollisionShape getCollisionShape() {
  if (collisionShape == null) {
    collisionShape = Bullet.obtainStaticNodeShape(get().nodes);
  }

  return collisionShape;
}
 
开发者ID:macbury,项目名称:ForgE,代码行数:8,代码来源:ModelAsset.java

示例15: create

import com.badlogic.gdx.physics.bullet.Bullet; //导入依赖的package包/类
@Override
public void create () {
  Bullet.init(false, true);
  files         = new FileManager();
  storage       = new StorageManager();
  db            = storage.loadOrInitializeDB();
  graphics      = new GraphicsUtils();
  screens       = new ScreenManager(this);
  assets        = new AssetsManager();
  shaders       = new ShadersManager();
  input         = new InputManager();
  blocks        = new BlocksProvider();
  levels        = new LevelManager(storage);
  entities      = new EntityManager();
  scripts       = new ScriptManager();
  fb            = new FrameBufferManager();
  time          = new TimeManager();
  thread        = Thread.currentThread();
  ui            = new UIManager();

  Gdx.input.setInputProcessor(input);
  for (ForgEBootListener listener : bootListeners) {
    listener.afterEngineCreate(this);
  }

  ForgE.input.addProcessor(0, ui);

}
 
开发者ID:macbury,项目名称:ForgE,代码行数:29,代码来源:ForgE.java


注:本文中的com.badlogic.gdx.physics.bullet.Bullet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。