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


Java Bullet.obtainStaticNodeShape方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: init

import com.badlogic.gdx.physics.bullet.Bullet; //导入方法依赖的package包/类
/**
 * Needs an initialized com.badlogic.gdx.physics.bullet.Bullet.
 */

public static void init() {
	loader = new ObjLoader();
	param = new ObjLoader.ObjLoaderParameters(true);

	BoundingBox boundingBox = new BoundingBox();


	FUEL = load("models/fuel.obj");
	FUEL.calculateBoundingBox(boundingBox);
	FUEL_SHAPE = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.8f));

	SHIELD = load("models/shield.obj");
	SHIELD.calculateBoundingBox(boundingBox);
	SHIELD_SHAPE = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.8f));


	ARTIFACT_MODELS.put(ATTRIBUTE_SPEED, 			load("models/artifact_speed.obj"));
	ARTIFACT_MODELS.put(ATTRIBUTE_INERTIA, 			load("models/artifact_inertia.obj"));
	ARTIFACT_MODELS.put(ATTRIBUTE_LANDSLIDE, 		load("models/artifact_landslide.obj"));
	ARTIFACT_MODELS.put(ATTRIBUTE_FUEL_CAPACITY, 	load("models/artifact_fuel.obj"));
	ARTIFACT_MODELS.put(ATTRIBUTE_SHIELD_CAPACITY, 	load("models/artifact_shield.obj"));
	ARTIFACT_MODELS.put(ATTRIBUTE_SCAN_RADIUS, 		load("models/artifact_radius.obj"));
	ARTIFACT_MODELS.put(ATTRIBUTE_LUCK, 			load("models/artifact_luck.obj"));
	ARTIFACT_MODELS.put(OPERATOR_PLUS, 				load("models/artifact_plus.obj"));
	ARTIFACT_MODELS.put(OPERATOR_MINUS, 			load("models/artifact_minus.obj"));
	ARTIFACT_MODELS.put(OPERATOR_MULTIPLY, 			load("models/artifact_multiply.obj"));
	ARTIFACT_MODELS.put(OPERATOR_DIVIDE, 			load("models/artifact_divide.obj"));
	ARTIFACT_MODELS.put(VALUE_100,		 			load("models/artifact_100.obj"));
	ARTIFACT_MODELS.put(VALUE_200,		 			load("models/artifact_200.obj"));
	ARTIFACT_MODELS.put(VALUE_500,		 			load("models/artifact_500.obj"));
	ARTIFACT_MODELS.put(VALUE_1000,		 			load("models/artifact_1000.obj"));
	ARTIFACT_MODELS.put(VALUE_2000,		 			load("models/artifact_2000.obj"));

	PLANET_PORTAL = 		load("models/planetPortal.obj");
	PLANET_PORTAL_TORUS = 	load("models/portalTorus.obj");

	PORTAL_STAND_COLLISION = Bullet.obtainStaticNodeShape(PLANET_PORTAL.nodes);

	Model portalTorusCollisionModel = load("models/planetPortalCollisionTube.obj");
	PORTAL_TUBE_COLLISION = Bullet.obtainStaticNodeShape(portalTorusCollisionModel.nodes);

	Model portalTriggerModel = load("models/portalTrigger.obj");
	PORTAL_TRIGGER_COLLISION = Bullet.obtainStaticNodeShape(portalTriggerModel.nodes);

	RACE_WAY_POINT = load("models/race_waypoint.obj");
	RACE_WAY_POINT.calculateBoundingBox(boundingBox);
	//Model raceWayPointTrigger = load("models/race_waypoint_trigger.obj");
	RACE_WAY_POINT_COLLISION = new btBoxShape(boundingBox.getDimensions(new Vector3()).scl(0.5f));
}
 
开发者ID:aphex-,项目名称:Alien-Ark,代码行数:54,代码来源:Models.java


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